Using (.NET) Microsoft Visual Basics ONLY: Chapter 4- 1. Based on the comment, w
ID: 3784537 • Letter: U
Question
Using (.NET) Microsoft Visual Basics ONLY:
Chapter 4-
1. Based on the comment, what is the logic error in the following code? (2 points)
'Display B for water state greater than or equal to 100
If tempC > 100 Then
Me.lblState.Text = "B"
End If
2. Study the If-ElseIf structure below and answer questions a and b.
Dim coffeeTempF As Integer = 60
If coffeeTempF > 100 Then
Me.lblMessage.Text = "Drink"
Elself coffeeTempF > 140 Then
Me.lblMessage.Text = "Too hot!"
Elself coffeeTempF < 100 Then
Me.lblMessage.Text = "Reheat"
End If
What is displayed in the label after the statements executes? (1 point)
Rewrite the code to work as intended? (3 points)
Explanation / Answer
1. greater than equal to condition is not correct
'Display B for water state greater than or equal to 100
If tempC >= 100 Then
Me.lblState.Text = "B"
End If
2.
(a) Reheat
(b)
Dim coffeeTempF As Integer = 60
If coffeeTempF > 100 Or coffeeTempF <=140 Then
Me.lblMessage.Text = "Drink"
Elself coffeeTempF > 140 Then
Me.lblMessage.Text = "Too hot!"
Elself coffeeTempF < 100 Then
Me.lblMessage.Text = "Reheat"
End If
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.