I wrote a console application that shows a survey of salespeople that earn a salary in a certain range based on their grossSales.
I am not getting the right results.
A salesperson makes $200 plus 9% commission on grossSales.
when I enter $5000 grossSales I get the result of the range
$700 - $799 and not
$600 - $699
(($5000 * 9)/ 100 ) + $200 = $650
What am I doing wrong.
Module Module1
Sub Main()
Dim index As Integer
Dim salary As Integer
Dim grossSales As Integer = 1
Dim salaryRange() As Integer = New Integer(10) {}
Console.WriteLine("Program to find number of salesmen in a salary range")
Console.WriteLine("Enter the salesman's gross sales(0 to end) : ")
grossSales = Console.ReadLine()
While (grossSales <> 0)
salary = 200 + ((9 * grossSales) / 100)
index = (salary / 100) - 1
If salary > 1000 Then
salaryRange(9) = salaryRange(9) + 1
Else
salaryRange(index) = salaryRange(index) + 1
End If
Console.WriteLine("Enter the salesman's gross sales(0 to end)")
grossSales = Console.ReadLine()
End While
For i = 0 To 8
Console.WriteLine("$" & i * 100 + 200 & "-$" & i * 100 + 299 & " is " & salaryRange(i + 1))
Next i
Console.WriteLine("$1000 and over " & salaryRange(8))
End Sub