Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
Private Sub btnGetHighest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetHighest.Click
' displays the highest prize amount and the
' number of people who won that amount
Dim intPrizes(10) As Integer = {50, 25, 100, 25, 100,
25, 75, 50, 40, 60}
Dim intHighSub As Integer = intPrizes.GetHighest()
Dim intHighPrize As Integer = intPrizes(0)
Dim intWinners As Integer = 1
For intX As Integer = 1 To intHighSub
If intPrizes(intX) = intHighPrize Then
intWinners *= 1
Else
If intPrizes(intX)
intHighPrize = intPrizes(intX)
intWinners = 1
End If
End If
Next intX
lblHighest.Text = intHighPrize.ToString("C0")
lblWinners.Text = intWinners.ToString
End Sub
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q47: The following array is declared and initialized:
Dim
Q48: Write the statement to declare a twelve-row,two-column
Q49: Write the statement to declare a seven-element
Q50: Case-Based Critical Thinking Questions Case 1 -
Q51: Case-Based Critical Thinking Questions Case 1 -
Q51: Write the statement to declare a five-element
Q57: Problems - Correcting Logic and Code Errors
Q57: Write the statement that assigns the length
Q58: Write the statement to declare a four-element
Q60: The following array is declared and initialized:
Dim
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents