Problems - Correcting Logic and Code ErrorsThe 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 Then
intHighPrize = intPrizes(intX)
intWinners = 1
End If
End If
Next intX
?
lblHighest.Text = intHighPrize.ToString("C0")
lblWinners.Text = intWinners.ToString
End Sub

What will be an ideal response?


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 amountDim intPrizes() As Integer = {50, 25, 100, 25, 100, 25,75, 50, 40, 60}Dim intHighSub As Integer = intPrizes.GetUpperBound(0)Dim intHighPrize As Integer = intPrizes(0)Dim intWinners As Integer = 1For intX As Integer = 1 To intHighSubIf intPrizes(intX) = intHighPrize ThenintWinners += 1ElseIf intPrizes(intX) > intHighPrize ThenintHighPrize = intPrizes(intX)intWinners = 1End IfEnd IfNext intXlblHighest.Text = intHighPrize.ToString("C0")lblWinners.Text = intWinners.ToStringEnd Sub

Computer Science & Information Technology

You might also like to view...

A recent college graduate should always include his or her grade point average on a resume even though it would not be advantageous to do so.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

?Choose the correct pronoun in the following sentence.Ed sent Brione and  __________  a list of people to invite.

A. ?her B. ?she

Computer Science & Information Technology

Default database options are provided in the Access Options dialog box.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

In a ____ cipher, a group or block of plaintext letters gets encoded into a block of ciphertext, but not by substituting one character at a time for each letter.

block recognition Caesar substitution

Computer Science & Information Technology