Write a program to accept the total number of hours and total sales of an employee of Shasha international, calculate and display the wages as per the commission they get. The hourly wage is 500/-.The commission is calculated as per the table below:
Total Sales Commission Rate
upto 1000 - 2.0%
1001 to 2000 - 2.5%
2001 – 5000 - 3.0%
Above 5000 - 4.0%
Answers
Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the total number of hours spent:");
int hours = sc.nextInt();
System.out.print("Enter the total sales amount:");
int sales = sc.nextInt();
int basicwage = 500*hours;
if(sales <= 1000){
double commision = (2/100d)*sales;
double totalSalary = basicwage + commision;
System.out.println("The total wages to be paid is " + totalSalary);
}
else if(sales >= 1001 && sales <= 2000){
double commision = (2.5/100d)*sales;
double totalSalary = basicwage + commision;
System.out.println("The total wages to be paid is " + totalSalary);
}
else if(sales >= 2001 && sales <= 5000){
double commision = (3/100d)*sales;
double totalSalary = basicwage + commision;
System.out.println("The total wages to be paid is " + totalSalary);
}
else if(sales > 5000){
double commision = (4/100d)*sales;
double totalSalary = basicwage + commision;
System.out.println("The total wages to be paid is " + totalSalary);
}
}
}
Explanation: