Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

/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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago