subject

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. 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.
3. do the same for the minimum sale.
4. 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 0—no one wants that designation. modify your program so that the ids run from 1-5 instead of 0-4. do not modify the array—just 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 salespeople 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 = 5;
int[] sales = new int[salespeople];
int sum;
scanner scan = new scanner(system. in);
for (int i=0; i {
system. out. print("enter sales for salesperson " + i + ": ");
sales[i] = scan. nextint();
}
system. out. println("\nsalesperson sales");
system. out. println(" ");
sum = 0;
for (int i=0; i {
system. out. println(" " + i + " " + sales[i]);
sum += sales[i];
}
system. out. println("\ntotal sales: " + sum);
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:00
Which of the following does 3d animation create an illusion of on the screen? a. depth b. emotion c. length d. dialogue
Answers: 1
question
Computers and Technology, 22.06.2019 12:50
You have just been hired as an information security engineer for a large, multi-international corporation. unfortunately, your company has suffered multiple security breaches that have threatened customers' trust in the fact that their confidential data and financial assets are private and secured. credit-card information was compromised by an attack that infiltrated the network through a vulnerable wireless connection within the organization. the other breach was an inside job where personal data was stolen because of weak access-control policies within the organization that allowed an unauthorized individual access to valuable data. your job is to develop a risk-management policy that addresses the two security breaches and how to mitigate these risks.requirementswrite a brief description of the case study. it requires two to three pages, based upon the apa style of writing. use transition words; a thesis statement; an introduction, body, and conclusion; and a reference page with at least two references. use a double-spaced, arial font, size 12.
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 1
question
Computers and Technology, 24.06.2019 12:50
What percentage of teens plays video games? a.97% b.100% c.74% d.50%
Answers: 1
You know the right answer?
File sales. java contains a java program that prompts for and reads in the sales for each of 5 sales...
Questions
question
Mathematics, 13.02.2021 01:00
question
Mathematics, 13.02.2021 01:00
question
Mathematics, 13.02.2021 01:00
question
Chemistry, 13.02.2021 01:00
question
Mathematics, 13.02.2021 01:00