Question: 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

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):

$200299

$300399

$400499

$500599

$600699

$700799

$800899

$900999

$1,000 and over

There are three places youll need to add code, and theyre commented in red below. Be sure to comment your code, because thats a part of the grade.

Use a one-dimensional array to solve the following problem: A company pays

/I Exercise 7.10 Solution: Sales.java Il Program calculates the amount of pay for a salesperson and counts the Il number of salespeople that earned salaries in given ranges import java.util.Scanner, public class Sales Il counts the number of people in given salary ranges public static void main(StringD args) Scanner inputnew Scanner(System.in); intl totalnew int[9]; // totals for the various salaries // initialize the values in the array to zero Il read in values and assign them to the appropriate range System.out.print("Enter sales amount (negative to end): "); double dollarsinput.nextDouble); while (dollars0) double salarydollars 0.09 + 200; int range (int) (salary / 100); if (range > 10) range10; ++total[range 2]; System.out.print("Enter sales amount (negative to end):"); dollarsinput.nextDouble) // print chart This can be one line of code for (your code to run the counter-you'll need to initialize the range, specify the condition, and increment the range.) System.out.printf("$%d-$%dit%dln" (200 + 100 *range), (299 + 100 * range), total[range]); Il special case for the last range System.out.printf("$1000 and overit%dln" total[total.length 1]); h Il end class Sales

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!