//Patrick Mc Gartoll
//Senior Division 3
//Barrington High School
//Barrington, RI
import java.util.Scanner;
public class TimeSheet
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
for(int i = 0; i < 5; i++) {
System.out.print("Input line: ");
String in = cin.nextLine();
in = in.replaceAll("A","10");
in = in.replaceAll("B","11");
in = in.replaceAll("C","12");
in = in.replaceAll("D","13");
in = in.replaceAll("E","14");
in = in.replaceAll("F","15");
in = in.replaceAll("G","16");
in = in.replaceAll("H","17");
String[] vals = in.split(" ");
double[] hours = convertValsToHours(vals);
int location = Integer.parseInt(vals[0].substring(0,vals[0].length()-1));
double totalPayment = 0.0;
double totalHours = sumOfHours(hours);
if(location>=100 && location<200) {
totalPayment=totalHours*10;
if(totalHours>30) {
totalPayment+=5*(totalHours-30);
}
} else if(location>=200 && location<300) {
totalPayment=totalHours*7.5;
if(totalHours>40) {
totalPayment+=7.5*(totalHours-40);
}
} else if(location>=300 && location<400) {
if(totalHours>20) {
totalPayment+=20*9.25;
totalPayment+=10.5*(totalHours-20);
} else {
totalPayment+=totalHours*9.25;
}
} else if(location>=400 && location<500) {
double diffHours = hours[0]+hours[6];
double totalNew = totalHours-diffHours;
totalPayment+=13.5*diffHours;
totalPayment+=6.75*totalNew;
} else if(location>=500 && location<600) {
for(int j = 0; j < hours.length; j++) {
if(hours[j]>6) {
totalPayment+=48;
totalPayment+=12*(hours[j]-6);
} else {
totalPayment+=8*hours[j];
}
}
}
System.out.printf("$%.2f\n",totalPayment);
}
}
public static double sumOfHours(double[] hours)
{
double sum = 0;
for(int i = 0; i < hours.length; i++)
{
sum+=hours[i];
}
return sum;
}
public static double[] convertValsToHours(String[] vals)
{
double[] result = new double[7];
for(int i=1; i<=7; i++)
{
String hoursString = vals[i].substring(0,vals[i].length());
String[] hoursSA = hoursString.split(",");
int hourDifference = Integer.parseInt(hoursSA[1]) - Integer.parseInt(hoursSA[0]);
result[i-1] = hourDifference/2.0;
}
return result;
}
}