A large company pays its salespeple a commission basis. The salespeople recive $
ID: 3631097 • Letter: A
Question
A large company pays its salespeple a commission basis. The salespeople recive $200 per week plus 9% of thier gross sales for the week. For example, a salesperson who sells $5000 worth of merchandise i a week recives $200 plus 9% of the $5000. or a total of $650. You've been supplied with a list of the items sold by each salesperson. The valuse of these items are as follows:Item value
1 239.99
2 129.75
3 99.95
4 350.89
Develop a Java application that inputs one salesperson's item sold for the last week and clculates and displays that salespersn's earnings. There's no limit to the number of items that can be sold.
Explanation / Answer
import java.util.*;
public class Test{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
System.out.print("Enter number of Employee: ");
final int N = input.nextInt();
double sale[] = new double [N];
double [] wage = new double[N];
for (int i =0; i<sale.length; i++){
System.out.print("Enter sale for employer "+(i+1)+": ");
sale[i]=input.nextDouble();
wage[i]=getWage(sale[i]);
input.nextLine();
}
String [] header ={"$200-299","$300-399","$400-499","$500-599","$600-699","$700-799","$800-899","$900-999","$1000 and over"};
int counter [] = new int [9];
for( int i = 0; i < wage.length; i++){
System.out.println(wage[i]);
if (wage[i] <300){
counter[0]++;
}else if (wage[i] >= 300 && wage[i] < 400){
counter[1]++;
}else if (wage[i] >= 400 && wage[i] < 500){
counter[2]++;
}else if (wage[i] >= 500 && wage[i] < 600){
counter[3]++;
}else if (wage[i] >= 600 && wage[i] < 700){
counter[4]++;
}else if (wage[i] >= 700 && wage[i] < 800){
counter[5]++;
}else if (wage[i] >= 800 && wage[i] < 900){
counter[6]++;
}else if (wage[i] >= 900 && wage[i] < 1000){
counter[7]++;
}else { counter[8]++;
}
}
// print the result in tabular form
for (int i = 0 ;i < header.length; i++)
System.out.println(header[i]+" "+counter[i]);
}
public static double getWage(double sale){
double wage = 200 + (sale*0.09);
return wage;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.