burntout 0 Newbie Poster

A company pays its salespeople on a commission basis. The salespeople
receive $200 per week, plus 9% of their gross sales for that week.
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
$300-$399
c) $400-$499
d) $500-$599
e) $600-$699
f) $700-$799
g) $800-$899
h) $900-$999
i) $1000 an over

Public Class SalarySurveyForm  

     'creating array of salary ranges  

     Dim SalaryRanges As String() = _  

            New String() {"200 - 299", "300 - 399", "400 - 499", "500 - 599", "600 - 699", "700 - 799", "800-899", "900-999", "1000-"} '<--over 999?  

     'creating empty int array that reps the number of salaries in each range  06     Dim Salaries() As Integer = New Integer(SalaryRanges.GetUpperBound(0)) {}  

    

    

    

    

     Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click  

    

         'getting the user input from sales and calculating commission based on ployee  

         Dim grossales As Double 

         Dim Salary As Double 

         Dim salespeople As Double 

           

         grossales = Val(inputSalesTextBox.Text)  

         Salary = (grossales * 0.09) + 200  

         totalSalaryValueLabel.Text = String.Format("{0:C}", Salary) 'displays employee salary in Total Salary label  

         'increment the element in array salaries that corresponds to the employees range   

         Salaries(0) += 1  

         salespeople -= 1  
    

    

    

     End Sub 

     Private Sub totalsButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles totalsButton.Click  

         'display salary distribution in the listbox, using a for next statement to display the range(element array in salaryRanges)and the number of employees whose salary falls in that range(element in array salaries)  

         salaryTotalsListBox.Items.Add("SalaryRange:" & ControlChars.Tab & "Total:") 'output headers in listbox  

         For SalaryRanges As Integer = 0 To 9  

             Salaries()  
    

         Next 

    

    
     End Sub 
End Class ' SalarySurveyForm

My gross salary formula works fine but im confused about my For Next Statement. Not sure if im doing it right. Any help will be appreciated.

i forgot one thing.... i'm not sure if my increment counter should be where i put it. I think it needs to be in my for next statement?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.