File Sales.java contains a Java program that prompts for and reads in the sales for each...
Fantastic news! We've Found the answer you've been seeking!
Question:
![image text in transcribed](https://s3.amazonaws.com/si.experts.images/answers/2024/05/66448b9ccbec6_22066448b9cb0f2c.jpg)
![image text in transcribed](https://s3.amazonaws.com/si.experts.images/answers/2024/05/66448b9d34724_22166448b9d0d9db.jpg)
Transcribed Image Text:
File Sales.java contains a Java program that prompts for and reads in the sales for each of 5 salespeople in a company. It then prints out the id and amount of sales for each salesperson and the total sales. Study the code, then compile and run the program to see how it works. Now modify the program as follows: 1. Compute and print the average sale. (You can compute this directly from the total; no loop is necessary.) 2. 3. 4. Find and print the maximum sale. Print both the id of the salesperson with the max sale and the amount of the sale, e.g., "Salesperson 3 had the highest sale with $4500." Note that you don't need another loop for this; you can do it in the same loop where the values are read and the sum is computed. Do the same for the minimum sale. After the list, sum, average, max and min have been printed, ask the user to enter a value. Then print the id of each salesperson who exceeded that amount, and the amount of their sales. Also print the total number of salespeople whose sales exceeded the value entered. 5. The salespeople are objecting to having an id of 0no one wants that designation. Modify your program so that the ids run from 1-5 instead of 0-4. Do not modify the arrayjust make the information for salesperson 1 reside in array location 0, and so on. 6. Instead of always reading in 5 sales amounts, at the beginning ask the user for the number of sales people and then create an array that is just the right size. The program can then proceed as before. // **** // Sales.java // // Reads in and stores sales for each of 5 salespeople. Displays ** // sales entered by salesperson id and total sales for all salespeople. // ****** import java.util.Scanner; public class Sales { public static void main(String[] args) { final int SALESPEOPLE int () = 5; sales new int [SALESPEOPLE]; int sum; **** Scanner scan new Scanner (System in) // // Reads in and stores sales for each of 5 salespeople. Displays // sales entered by salesperson id and total sales for all salespeople. // // ******* import java.util.Scanner; public class Sales { public static void main(String[] args) { final int SALESPEOPLE int () = 5%; sales = new int [SALESPEOPLE]; int sum; **** Scanner scan = new Scanner(System.in); for (int i=0; i File Sales.java contains a Java program that prompts for and reads in the sales for each of 5 salespeople in a company. It then prints out the id and amount of sales for each salesperson and the total sales. Study the code, then compile and run the program to see how it works. Now modify the program as follows: 1. Compute and print the average sale. (You can compute this directly from the total; no loop is necessary.) 2. 3. 4. Find and print the maximum sale. Print both the id of the salesperson with the max sale and the amount of the sale, e.g., "Salesperson 3 had the highest sale with $4500." Note that you don't need another loop for this; you can do it in the same loop where the values are read and the sum is computed. Do the same for the minimum sale. After the list, sum, average, max and min have been printed, ask the user to enter a value. Then print the id of each salesperson who exceeded that amount, and the amount of their sales. Also print the total number of salespeople whose sales exceeded the value entered. 5. The salespeople are objecting to having an id of 0no one wants that designation. Modify your program so that the ids run from 1-5 instead of 0-4. Do not modify the arrayjust make the information for salesperson 1 reside in array location 0, and so on. 6. Instead of always reading in 5 sales amounts, at the beginning ask the user for the number of sales people and then create an array that is just the right size. The program can then proceed as before. // **** // Sales.java // // Reads in and stores sales for each of 5 salespeople. Displays ** // sales entered by salesperson id and total sales for all salespeople. // ****** import java.util.Scanner; public class Sales { public static void main(String[] args) { final int SALESPEOPLE int () = 5; sales new int [SALESPEOPLE]; int sum; **** Scanner scan new Scanner (System in) // // Reads in and stores sales for each of 5 salespeople. Displays // sales entered by salesperson id and total sales for all salespeople. // // ******* import java.util.Scanner; public class Sales { public static void main(String[] args) { final int SALESPEOPLE int () = 5%; sales = new int [SALESPEOPLE]; int sum; **** Scanner scan = new Scanner(System.in); for (int i=0; i
Expert Answer:
Posted Date:
Students also viewed these programming questions
-
Bethesda Mining Company reports the following balance sheet information for 2018 and 2019.BETHESDA MINING COMPANY Balance Sheets as of December 31, 2018 and 2019 Assets 20182019 LiabilitiesandOwners'...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Control Theory allows us to find various useful properties of a system such as stability. Draw a picture of a generic control system, explaining the functions of feedback and the design goals for the...
-
What constant should replace the question mark in this system so that the solution set is {(1, 1, 1)}? 2x - 3y + -5x + 2y z = 0 - 2 = x + y + 2z = ? 4 -4
-
The ability to estimate the volume of a tree based on a simple measurement, such as the tree's diameter, is important to the lumber industry, ecologists, and conservationists. Data on volume, in...
-
Who are the providers (savers) and users (borrowers) of capital? How is capital transferred between savers and borrowers? MINI CASE Assume that you recently graduated with a degree in finance and...
-
As a leader, what actions demonstrate your trust of other people?
-
The following table summarizes information about the market for principles of economics textbooks: a. What is the market equilibrium price and quantity of textbooks? b. To quell outrage over tuition...
-
In B 2 B sales, _ _ _ _ _ _ _ _ _ _ . In B 2 B sales, _ _ _ _ _ _ _ _ _ _ . you should focus immediately on closing. you do not need to include rapport building. you are generally approaching your...
-
In which order do the following gets evaluated 1. Relational 2. Arithmetic 3. Logical 4. Assignment 2134 1234 4321 3214
-
Hospitality in the Big City1. How does this case illustrate the importance of 2. How important is it to defuse unpleasantness even 3.Describe any similar experiences you may havehad where people...
-
Over the year, the Mars company has changed both the colors and the proportion of colors for M&M candies. The original colors were red, yellow, violet, green and brown. In 1995 blue was introduced....
-
Questions below based on figure above: Consider the Arithmetic Logic Unit (ALU) block diagram shown in Fig. 1(a). Each block is numbered in brackets, for example (1), (2)... (10). The D-Flip-Flops...
-
Inventory Beginning Balance Ending Balance $27,000 Accounts Receivables 21,000 Accounts Payables 10,000 $28,000 22,000 14,000 Consider the above balances and if Credit Sales were $175,000 and the...
-
44x If a basketball player shoots a foul shot, releasing the ball at a 45-degree angle from a position 6 feet above the floor, then the path of the ball can be modeled by the quadratic function, h(x)...
-
Let array1, and array2 be two arrays of SDWORDS defined in an assembly program. Let both of them be defined to contain the same number of elements. Write assembly code that goes through the entire...
-
The column shown in the figure is fixed at the base and free at the upper end. A compressive load P acts at the top of the column with an eccentricity e from the axis of the column. Beginning with...
-
Bruce Farms Equipment Company had goodwill valued at \(\$ 80\) million on its balance sheet at year-end. A review of the goodwill by the company's CFO indicated that the goodwill was impaired and was...
-
The Queen Company reported net income of \(\$ 80,000\) and average total assets of \(\$ 450,000\). Calculate the company's return on assets.
-
The Kingwood Company reported sales revenue of \(\$ 520,000\) and average total assets of \(\$ 500,000\). Calculate the company's asset turnover.
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App