Welcome to Westonci.ca, the Q&A platform where your questions are met with detailed answers from experienced experts. Get detailed and precise answers to your questions from a dedicated community of experts on our Q&A platform. Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals.
Sagot :
Answer:
The program is as follows:
import java.util.*;
public class Sales{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int salesPeople;
System.out.print("Number of Sales People: ");
salesPeople = input.nextInt();
int[] salesID = new int[salesPeople];
float[] salesAmount = new float[salesPeople];
float total = 0;
for(int i = 0; i<salesPeople;i++){
System.out.print("ID: "); salesID[i] = input.nextInt();
System.out.print("Amount: "); salesAmount[i] = input.nextFloat();
total+=salesAmount[i]; }
System.out.println("ID\t\tAmount");
for(int i = 0; i<salesPeople;i++){
System.out.println(salesID[i]+"\t\t"+salesAmount[i]); }
System.out.println("Total Sales: "+total);
System.out.println("Average Sales: "+total/salesPeople);
Arrays.sort(salesAmount);
System.out.println("Minimum Sales: "+salesAmount[0]);
System.out.println("Maximum Sales: "+salesAmount[salesPeople-1]);
float sales;
System.out.print("Print records that exceed: "); sales = input.nextFloat();
System.out.println("\nID\t\tAmount");
int count = 0;
for(int i = 0; i<salesPeople;i++){
if(salesAmount[i]>sales){
System.out.println(salesID[i]+"\t\t"+salesAmount[i]);
count++; } }
System.out.print("Total sales records that exceed "+sales+" are: "+count);
}
}
Explanation:
See attachment for program source file where comments are used as explanation
Thanks for using our service. We aim to provide the most accurate answers for all your queries. Visit us again for more insights. We appreciate your time. Please come back anytime for the latest information and answers to your questions. Get the answers you need at Westonci.ca. Stay informed by returning for our latest expert advice.