Im having a hard time. I have to
get the overtime pay and hours calculated Im thinking there is something wrong in my if-else statment?
import java.util.*; public class Payroll { private static Scanner console = new Scanner(System.in); public static void main(String args[]) { int numberOfWeeks; String employeeID; String employeeName; double pr; //pay rate double pay; int hw; //hours worked double overtimeHours; char moreEmployees; double monthlyPay; double totalPay; double overtimePay; int hours; double overtimeRate = 1.5; System.out.println("Please enter number of weeks to process: "); numberOfWeeks = console.nextInt(); do { System.out.println("Please enter employeeID: "); employeeID = console.next(); System.out.println("Please enter employeeName: "); employeeName = console.next(); System.out.println("Please enter pay rate: "); pr = console.nextDouble(); monthlyPay = 0; for (int x = 1; x <= numberOfWeeks; x++) { System.out.println("Please enter hours worked: "); hw = console.nextInt(); pay = hw * pr; monthlyPay = monthlyPay + pay; } if ( hours > 40) { hw = 40; overtimeHours = hours - 40; } else { hw = hours; overtimeHours = 0; } pay = pr * hw; overtimePay = overtimeRate * overtimeHours; monthlyPay = pay + overtimePay; System.out.println("--------------------------------------------"); System.out.println("Employee: " + employeeName); System.out.println("Pay: " + monthlyPay); System.out.println("--------------------------------------------"); totalPay = totalPay + monthlyPay; System.out.println("More employees? y/n"); moreEmployees = console.next().charAt(0); }while (moreEmployees == 'Y' || moreEmployees == 'y'); System.out.println("--------------------------------------------"); System.out.println("--------------------------------------------"); System.out.println("Total Monthly Payroll: " + totalPay); System.out.println("--------------------------------------------"); System.out.println("--------------------------------------------"); } }