Westonci.ca is the best place to get answers to your questions, provided by a community of experienced and knowledgeable experts. Connect with a community of experts ready to help you find accurate solutions to your questions quickly and efficiently. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable 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
We hope our answers were helpful. Return anytime for more information and answers to any other questions you may have. Your visit means a lot to us. Don't hesitate to return for more reliable answers to any questions you may have. Thank you for trusting Westonci.ca. Don't forget to revisit us for more accurate and insightful answers.