VB assignment
Determine the output displayed when the button is clicked.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim num As Double = 0 Dim max As Double = -1 Dim prompt As String = “ Enter a nonnegative number. “ & Enter -1 to terminate entering numbers.” Num = CDbl(Input Box(prompt)) Do While num >= 0 If num > max Then Max = num End If Num = CDbl(InputBox(prompt)) Loop If max <> -1 Then MessageBox.Show(“Maximum number: “ & max) Else MessageBox.Show(“No numbers were entered.”) End If Assu;me that the responses are 4, 7, 3, and -1)
2. Replace each phrase containing "Until" with an equivalent phrase containing "While", and vice versa. For instance, the phrase (Until sum = 100) would be replaced by (While sum <> 100).
While (ans = "Y") And (n < 7) 3. Determine the output displayed when the button is clicked.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim word As String = “courage” Dim letter As String = “” Dim numVowels As Integer = 0 For i As Integer = 0 To word.length – 1 Letter = word.Substring(I, 1) If IsVowel (letter) Then numVowels += 1 End If Next txtBox.Text = CStr(numVowels) End Sub Function IsVowel(ByVal letter As String) As Boolean Letter = letter.ToUpper If (letter = “A” Or (letter = “E”) Or (letter = “I”) Or (letter = “O”) Or (letter = “U”) Then Return True Else Return False End If End Function