Brooke C.

asked • 03/22/15

How do I do the following problems? PLEASE HELP!

46) Simplify the following nested If statement to a non-nested if statement.

If (num1 > 10) Then
If (num1 < 20) Then
txtOutput.Text = "The number is in the range "
End If
End If



47) Change the following If block to Select Case statement.

Dim a As Integer = CInt(InputBox("Number"))
If a=1 Then
txtOutput.Text = "One"
ElseIf 2<=a And a<=10 Then
txtOutput.Text = "Medium"
ElseIf a>10 Then
txtOutput.Text = "Big"
Else
txtOutput.Text = "Negative"
End If


48) What will be the output (on txtBox) of the following statements?

1) Dim str As String = "stroll"
str = str.SubString(1) & str.SubString(0,1)
txtBox.Text = str

The output is

2) Dim num As Double = 0
Select Case num
Case Is < 10
txtBox.Text = "Small"
Case 0 To 60
txtBox.Text = "Middle"
Case Is <= 100
txtBox.Text = "Big"
Case Else
txtBox.Text = "Wrong Input"
End Select

The output is

3) Dim x, y As Double
x = 2
y = 8
Select Case x + y
Case x To y / x, y
txtBox.Text = "ONE"
Case Is >= x * y, 11
txtBox.Text = "TWO"
Case y – x, 10
txtBox.Text = "THREE"
Case Else
txtBox.Text = "NONE"
End Select

The output is

4) Dim n1, n2, n3 As Integer
n1 = 5
n2 = 10
n3 = 20
If n1 > n2 And n1 > n3 Then
txtBox.Text = CStr(n1)
ElseIf n2 > n3 Then
txtBox.Text = CStr(n2)
Else
txtBox.Text = CStr(n3)
End If

The output is

5) Dim c As String
txtBox.Text = CStr(Asc("A")+7) + CStr(ASC("a")+8)

The output is


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.

4) btnCompute.Caption = "Do It!" 'Change the caption of a button

1 Expert Answer

By:

Amy M. answered • 03/22/15

Tutor
5.0 (1,583)

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.