Question: 7 . 1 0 ( Sales Commissions ) Use a one - dimensional array to solve the following problem: A company pays its salespeople on

7.10(Sales Commissions) Use a one-dimensional array to solve the following problem: 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 $5,000 in sales in a week receives $200 plus 9% of $5,000, or a total of $650. Write an application (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salespersons salary is truncated to an integer amount):
1. $200299
2. $300399
3. $400499
4. $500599
5. $600699
6. $700799
7. $800899
8. $900999
9. $1,000 and over
Summarize the results in tabular format.
this is what i have so far.
import java.util.Scanner;
public class SalesCommission {
public static void main(String[] args){
int[] counters=new int[9];
Scanner input = new Scanner(System.in);
while (true){
System.out.print("Please enter gross sales of the week ( S to stop): ");
double sales = input.nextDouble();
if(sales==S)
break;
double total =200+(9/100.0* sales );
System.out.println("You will receive "+total+" this week.");
int index =(int)total/100;
if(index>10)
index=10;
counters[index-2]++;
}
System.out.println("Counters are: ");
for(int i=0;i<8;i++)
{
System.out.printf("$[%d-%d]==>%d
",200+i*100,299+i*100, counters[i]);
}
System.out.println("$1000 and over ==>"+ counters[8]);
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!