import java.util.*;
public class AcmePay {
public static void main(String[] args) throws Exception {
double regularPay = 0, overPay = 0;
double wage1 = 17, wage2 = 18.50, wage3 = 22, time = 0;
double overworkMethod = 1.5, retirementDeduction = 0;
Scanner input = new Scanner (System.in);
System.out.println("Please enter shift - 1, 2, or 3");
int shift = input.nextInt();
System.out.println("Please enter hours worked");
double hoursWorked = input.nextDouble();
//regular pay
if (shift == 1 && hoursWorked > 40){
regularPay = (40 * wage1);
}
else if (shift == 2 && hoursWorked > 40){
regularPay = (40 * wage2);
}
else if (shift == 3 && hoursWorked > 40){
regularPay = (40 * wage3);
}
else if (shift == 1 && hoursWorked < 40){
regularPay = wage1 * hoursWorked;
}
else if (shift == 2 && hoursWorked < 40){
regularPay = wage2 * hoursWorked;
}
else if (shift == 2 && hoursWorked < 40){
regularPay = wage2 * hoursWorked;
}
// OVER PAY
if (hoursWorked > 40 && shift == 1){
overPay = (hoursWorked - 40) * (wage1 * 1.5);
}
else if (hoursWorked > 40 && shift == 2) {
overPay = (hoursWorked - 40) * (wage2 * 1.5);
}
else if (hoursWorked > 40 && shift == 3){
overPay = (hoursWorked - 40) * (wage3 * 1.5);
}
else if (hoursWorked < 40 && (shift == 1 || shift == 2 || shift == 3)){
overPay = 0.0;
}
//NET PAY
double netPay = 0;
if (shift == 1) {
netPay = overPay + regularPay;
}
else if ((shift == 2 || shift == 3) && retirementDeduction == 0.0){
netPay = overPay + regularPay;
}
else if ((shift == 2 || shift == 3) && retirementDeduction > 0.0){
netPay = ((overPay + regularPay) - retirementDeduction);
}
//retirement deduction
if (shift == 2 || shift == 3) {
System.out.println("Do you want to participate in the retirement plan?\\ Enter 1 for Yes and 2 for No.");
int chooseRetirement = input.nextInt();
if (chooseRetirement == 1 && shift == 2) {
retirementDeduction = (netPay * 0.03);
}
else if (chooseRetirement == 1 && shift == 3){
retirementDeduction = (netPay * 0.03);
}
}
System.out.println("Hours worked is " + hoursWorked);
if (shift == 1){
System.out.println("Hourly pay rate is " +wage1);
}
else if (shift == 2){
System.out.println("Hourly pay rate is " +wage2);
}
else {
System.out.println("Hourly pay rate is " +wage3);
}
System.out.println("Regular pay is " + regularPay);
System.out.println("Overtime pay is " + overPay);
System.out.println("Retirement deduction is " + retirementDeduction);
System.out.println("Net pay is...................." + (netPay - retirementDeduction));
}
}