In: Computer Science
Needs to be in JAVA. Write a Java program that accepts the total amount of cars sold and total sales amount of a car salesperson for a given month.
The salesperson’s paycheck is computed as follows:
a. Every sales person gets 10% (commission) of total sales
b. Sales totals greater than $50,000 get 5% of total sales amount
c. 8 or more cars sold earns the salesperson an extra 3%
Please remove 30% (taxes) of the gross pay and list the paycheck amount.
import java.util.Scanner;
public class CarSalesPerson {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int totalCarsSold;
double totalSales;
System.out.print("Enter total amount of cars sold: ");
totalCarsSold = scanner.nextInt();
System.out.print("Enter total sales amount of a car salesperson for a month: ");
totalSales = scanner.nextDouble();
double amount = totalSales/10;
if(totalSales > 50000){
amount += (totalSales*(5.0/100));
}
if(totalCarsSold>=8){
amount += (totalSales*(3.0/100));
}
double grossPay = amount*(30.0/100);
System.out.println("Gross pay = "+grossPay);
amount = amount - grossPay;
System.out.println("Pay check amount = "+amount);
}
}