I have created a method in java in my menu list and I have toput all the work into the method but I cannot get it to print andam not sure where I am going wrong. this is my code:
public staticvoid main(String[] args) {
// TODO Auto-generated method stub
Scanner in = newScanner(System.in);
String fName = \"\";
String lName = \"\";
double hoursWorked;
double hourlyRate;
int optionOne = 1;
int optionTwo = 2;
int optionThree = 3;
int optionFour = 4;
int choice;
System.out.println(\"CalculatorMenu\");
System.out.println(\"1) WageCalculator\");
System.out.println(\"2) CouponCalculator\");
System.out.println(\"3) Roman NumberConverter\");
System.out.println(\"4) Exit\");
System.out.println(\"\");
System.out.println(\"Enter choice:\");
choice = in.nextInt();
switch(choice) {
case 1:
System.out.println(\"Enter first name:\");
fName = in.next();
System.out.println(\"Enter last name:\");
lName = in.next();
System.out.println(\"Enter hourly rate:\");
hourlyRate = in.nextDouble();
System.out.println(\"Enter hoursworked: \");
hoursWorked = in.nextDouble();
System.out.printf(\"Name: \" + fName +\",\" + lName);
System.out.println(\"\");
wageCalculator();
break;
case 2:
double purchaseAmount;
int purchaseType;
final double autoP = 1;
final double frag = 2;
final double acc = 3;
System.out.println(\"Enter purchaseamount: \");
purchaseAmount = in.nextDouble(); {
System.out.println(\"Choose purchasetype: \");
System.out.println(\"1) AutoParts\");
System.out.println(\"2)Fragrances\");
System.out.println(\"3)Accessories\");
purchaseType = in.nextInt();
} if (purchaseType == autoP) {
System.out.println(\"Your coupon is: $\"+ purchaseAmount*.10 + \"(Auto Parts)\");
} if (purchaseType == frag) {
System.out.println(\"Your coupon is: $\"+ purchaseAmount*.15 + \"(Fragrances)\");
} if (purchaseType == acc) {
System.out.println(\"Your coupon is: $\"+ purchaseAmount*.20 + \"(Accessories)\");
}
break;
case 3:
double calc_wages;
System.out.println(\"No option rightnow\");
break;
case 4:
System.out.println(\"Thank you forusing our program. Have a great day!\");
}
// public static int convertRomanNumber(String str). {
// }
}
private staticvoid wageCalculator() {
// TODO Auto-generated method stub
double hoursWorked = 0;
double hourlyRate = 0;
double overtimeHours;
double overtimePay = 0;
double regularPay = 0;
if (hoursWorked > 40) {
overtimeHours = hoursWorked - 40;
System.out.println(\"Overtime hours: \"+ overtimeHours);
overtimePay = overtimeHours*(1.5*hourlyRate);
System.out.println(\"Overtime Pay: \" +overtimePay);
hoursWorked = 40;
}
regularPay = hourlyRate*hoursWorked;
System.out.println(\"Regular hoursworked: \" + hoursWorked);
System.out.println(\"Regular Pay: $\" +regularPay);
System.out.printf(\"Total Pay $%.2f\",regularPay + overtimePay);
}
}