import java.util.Scanner; import java.io.*; class Timesheet { public static double getTime(String timeCode){ double time = 0; switch(timeCode){ case "1": time = 9; break; case "2": time = 9.5; break; case "3": time = 10; break; case "4": time = 10.5; break; case "5": time = 11; break; case "6": time = 11.5; break; case "7": time = 12; break; case "8": time = 12.5; break; case "9": time = 13; break; case "A": time = 13.5; break; case "B": time = 14; break; case "C": time = 14.5; break; case "D": time = 15; break; case "E": time = 15.5; break; case "F": time = 16; break; case "G": time = 16.5; break; case "H": time = 17; break; default: System.exit(1); } return time; } public static double subtractHours(String start, String end){ return getTime(end) - getTime(start); } public static double getRegularRate(int location){ double regularRate = 0; if(location<=199){regularRate = 10;} else if(location>=200 && location<=299){regularRate = 7.5;} else if(location>=300 && location<=399){regularRate = 9.25;} else if(location>=400 && location<=499){regularRate = 6.75;} else{regularRate = 8;} return regularRate; } public static double getOvertimeRate(int location){ double overtimeRate = 0; if(location<=199){overtimeRate = 15;} else if(location>=200 && location<=299){overtimeRate = 15;} else if(location>=300 && location<=399){overtimeRate = 10.5;} else if(location>=400 && location<=499){overtimeRate = 13.5;} else{overtimeRate = 12;} return overtimeRate; } public static double getHoursOfOvertime(int location, int day, double totalhours){ double hours = 0; if(location<=199){ hours = Math.max(0, totalhours-5); } else if(location>=200 && location<=299){ hours = Math.max(0, totalhours-6); } else if(location>=300 && location<=399){ hours = Math.max(0, totalhours-4); } else if(location>=400 && location<=499){ if(day==1 || day==7){hours = totalhours;} } else{ hours = Math.max(0, totalhours-6); } return hours; } public static double getPay(int location, int day, String start, String end){ double hours = subtractHours(start, end); double pay = (hours-getHoursOfOvertime(location, day, hours))*getRegularRate(location); pay += getHoursOfOvertime(location, day, hours) * getOvertimeRate(location); return pay; } public static void main(String[] args) throws IOException { Scanner leslie = new Scanner(new FileReader("data/input.txt")); for(int i=0; i<5; i++){ String inputs[] = leslie.nextLine().split(", "); double pay = getPay(Integer.parseInt(inputs[0]), Integer.parseInt(inputs[1]), inputs[2], inputs[3]); pay += getPay(Integer.parseInt(inputs[4]), Integer.parseInt(inputs[5]), inputs[6], inputs[7]); System.out.print("$" + pay); if((pay*100)%10 == 0){System.out.println("0");} else{System.out.println();} } } }