How do i use array of counters for this problem?
. For example, a salesperson who grosses $5000 in sales in a week receives $200 plus 9% of $5000, or a total of $650. Develop a console program (using a one-dimensional array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson’s salary is truncated to an integer amount):
a) $200-$299
b) $300-$399
c) $400-$499
d) $500-$599
e) $600-$699
f) $700-$799
g) $800-$899
h) $900-$999
i) $1000 an over
Here is my code
Module Lab4
'Brad Bebout
'Lab4
Sub Main()
Dim Commission(8) As String
Commission(0) = "$200-$299"
Commission(1) = "$300-$399"
Commission(2) = "$400-$499"
Commission(3) = "$500-$599"
Commission(4) = "$600-$699"
Commission(5) = "$700-$799"
Commission(6) = "$800-$899"
Commission(7) = "$900-$999"
Commission(8) = "$1000 an over"
Dim counter As Integer() = New Integer(8) {0, 1, 2, 3, 4, 5, 6, 7, 8}
Dim total As Integer = 0, i As Integer = 0
Dim var1 As Double
Dim result As Integer
Console.WriteLine("How many salespeople are in the company?")
Console.ReadLine()
Console.WriteLine("What were the gross sales for the week?")
var1 = Console.ReadLine()
Console.WriteLine("This persons earnings were " & (var1 * 0.09) + 200)
' sum array element values
While var1 > "0"
If var1 = "$200-$299" Then
counter(0) += 1
ElseIf var1 = "$300-$399" Then
counter(1) += 1
ElseIf var1 = "$400-$499" Then
counter(2) += 1
ElseIf var1 = "$500-$599" Then
counter(3) += 1
ElseIf var1 = "$600-$699" Then
counter(4) += 1
ElseIf var1 = "$700-$799" Then
counter(5) += 1
ElseIf var1 = "$800-$899" Then
counter(6) += 1
ElseIf var1 = "$900-$999" Then
counter(7) += 1
ElseIf var1 = "$1000 an over" Then
counter(8) += 1
ElseIf var1 < "0" Then
Console.WriteLine("Invalid entry")
End If
Console.WriteLine("Total of array elements: " & total, _
"Sum the elements of an Array")
End While
For i = 0 To counter.GetUpperBound(0)
Next
Console.WriteLine("Hit Enter to Exit")
Console.ReadLine()
End Sub ' Main
End Module ' Lab4
any help would be appreciated.