Code for Waterglen Horse Farms application? [migrated]
- by user73459
I am having trouble with the solution to the Waterglens Horse Farms application in the Visual Basic 2010 Reloaded book. The problem reads:
Each year Sabrina Cantrell, owner of waterglen horse farms enters four of her horses in five local horse races. She uses the table shown below to keep track of her horses in 5 local races. in the table , a 1 shows that the horse won a race, a 2 shows 2nd place, a 3 is 3rd place , and a 0 the horse didn't finish in the top 3.
More details in these 2 images: http://imgur.com/a/YTNEX
Here is what I have tried so far:
Dim racescores(,) As Integer = {{0, 1, 0, 3, 2},
{1, 0, 2, 0, 0}, {0, 3, 0, 1, 0}, {3, 2, 1, 0, 0}}
Dim subscript As Integer = 0
Dim noplace As Integer = 0
If horse1RadioButton.Checked Then
Do While subscript < racescores(3, 4)
If racescores(0, subscript) = 0 Then
noplace = noplace + 1
End If
subscript = subscript + 1
Loop
noPlaceDisplayLabel.Text = noplace
End If