import java.util.Scanner;// invokes scanner public classSalaryCalculation{ publi
ID: 3614112 • Letter: I
Question
import java.util.Scanner;// invokes scanner
public classSalaryCalculation{
public static void main(String[]args){
// Definevariables
// create a Scanner
Scanner input= new Scanner(System.in);
// Promt the user to enter
System.out.print("Enter week number: ");
int n1 = input.nextInt();
System.out.print("Enter Employee's name: ");
String name = input.next();
System.out.print(" Enter 0 for (Hourly-based Employees) " +"Enter 1 for (Piece-based Employees) " +
"Enter 2 for (Sales Agent) " + " EnterEmployee type: ");
int type = input.nextInt();
if(type == 0){
System.out.print("Enter Hourly salary: ");
double hourly = input.nextDouble();
System.out.print("Enter number of hours worked: ");
int hoursWorked= input.nextInt();
double salary;
salary = hourly*hoursWorked;
System.out.println(" Big E Trailers, inc");
System.out.println("==================================");
System.out.println("Week #: " + n1);
System.out.println("Employee name: " +name);
System.out.println("Employee type: " +type);
System.out.println(" Hourly salary: " + hourly+ " Dollars");
System.out.println("Number of worked hours: " +hoursWorked);
System.out.println("Salary due: " + salary);
}
else if (type == 1){
System.out.print("Enter number of pieces made: ");
int pieces = input.nextInt();
System.out.print("Enter Wage Per Piece: ");
double wage = input.nextDouble();
double salary;
salary =pieces * wage;
System.out.println(" Big ETrailers, inc");
System.out.println("==================================");
System.out.println("Week #: " +n1);
System.out.println("Employee name: "+ name);
System.out.println("Employee type: "+ type);
System.out.println(" Enter numberof Items produced: " + pieces);
System.out.println("Enter wageprice: " + wage);
System.out.println("Salary due: " + salary);
}
else if (type == 2) {
System.out.print("Enter number of sold items:");
int soldItems = input.nextInt();
System.out.print("Enter commission value: ");
double commission= input.nextDouble();
System.out.print("Enter base weekly salary:");
double wSalary = input.nextDouble();
doublesalary;
salary = (soldItems*commission) + wSalary ;
System.out.println(" Big E Trailers, inc");
System.out.println("==================================");
System.out.println("Week #: "+ n1);
System.out.println("Employee name: " +name);
System.out.println("Employee type: " +type);
System.out.println(" Enter sold items: " +soldItems);
System.out.println("Enter commission value: " +commission);
System.out.println("Salary due: " + salary);
}
else {
System.out.println("THe value is wrong:");
}
}
}