Brooke C.

asked • 03/22/15

How do I write the first statement? And how do I do the following problems? Please help

Write ONE Dim statement that declares a string variable fisrtName with initial value "Davis" and a double variable Score with initial value 99 (ONE statement).
 
 
The following statements have syntax error(s). Specify and correct all the errors.
frmMidterm is the name of a form.
btnCompute is the name of a button control.
1) Dim x, y As Double = 5.0
 
2) Dim hyp, a, b As Double 'Compute hypotenus using Pythagorean Theorem
a = 4.0
b = 3.0
hyp ^ 2 = a ^ 2 + b ^ 2
 
3) 'Change the caption of the form
frmMidterm.Text = "Project Done"
 
4) btnCompute.Caption = "Do It!" 'Change the caption of a button
Dim dist As Double
dist = CDbl(txtInput.Text)
If (-1.0 < dist < 1.0) Then
txtOutput.Text = "Inside a Unit Circle"
End If
 
6) Dim age As Integer
age = CInt(InputBox("Enter your age"))
If age > 65 Then
txtOutput.Text = "Senior"
If age > 12 Then
txtOutput.Text = "Adult"
Else
txtOutput.Text = "Children”
End If
 
7) Dim str as String = InputBox("What's your favorite sports?")
Select Case str
Case Is = "Basketball"
txtOutput.Text = "Basketball"
Case Otherwise
txtOutput.Text = "Hate Sports"
End Select
 

1 Expert Answer

By:

Amy M. answered • 03/22/15

Tutor
5.0 (1,582)

CalTech Grad, Software engineer with 30+ years experience.

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.