Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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:");
     
     }

    }
   }


Explanation / Answer

please rate - thanks import java.util.Scanner; // invokes scanner    public class untitled{      public static void main(String[]args){       // Define variables      int n1, hoursWorked;       String type;      // create a Scanner      Scanner input= new Scanner(System.in);     // Promt the user to enter     do    {     System.out.print("Enter week number: ");      n1 = input.nextInt();       if(n152)           System.out.println("Invalid entry-must be between 1 and 52 ");       }while((n152));           System.out.print("Enter Employee's name:");      String name = input.next();      System.out.print(" Enter HE for(Hourly-based Employees) " + "Enter PE for (Piece-basedEmployees) " +      "Enter SA for (Sales Agent) " + " EnterEmployee type: ");       type = input.next();     if (type.equals("HE")){     System.out.print("Enter Hourly salary: "); double hourly = input.nextDouble(); do    { System.out.print("Enter number of hours worked: "); hoursWorked= input.nextInt(); if(hoursWorked>70)           System.out.println("Invalid entry-must be between 1 and 52 ");       }while(hoursWorked>70);     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.equals("PE")) { 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.equals("SA"))) {    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();    double salary;    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: ");          }     }    }