Tracking Sales The file Sales.java contains a Java program that prompts for and
ID: 3654829 • Letter: T
Question
Tracking Sales The 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 each salesperson's ID, each salesperson's amount of sales, and the total sales across all salespeople. Take a look at the code to figure out how it's structured and what it's up to. Now modify and improve the program as follows: Compute and print the average sale amount. 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." Do the same for the minimum sale. If you've done every thing correctly, this is what running the program might look like (bold, bracketed text indicates user input): If you've done every thing correctly, this is what running the program might look like (bold, bracketed text indicates user input): Enter sales tor salesperson0: $[4200] Enter sales tor salesperson1: $[3600] Enter sales tor salesperson2: $[8700] Enter sales tor salesperson3: $[1200.5] Enter sales tor salesperson4: $[6800] Total sales: $24,500.50 Average sales: $4,900.10 Salesperson 2 had the highest sale with $8,700.00 Salesperson 3 had the lowest sale with $1,200.50Explanation / Answer
code is below, or you can take it from here for it to be structured http://codepad.org/OOkVzSik import java.util.Scanner; public class Sales { public static void main(String[] args) { final int SALESPEOPLE = 5; double[] sales = new double[SALESPEOPLE]; double sum=0.0; int min=0,max=0; Scanner scan = new Scanner(System.in); for(int i =0;isales[i]) min=i; } System.out.println(" Total sales: "+sum); System.out.println("Average sales: "+sum/SALESPEOPLE); System.out.println("Sales person "+max+" had the highest sales with $"+sales[max]); System.out.println("Sales person "+min+" had the lowest sales with $"+sales[min]); } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.