import java.util.Scanner; public class Payroll4 /** This class demonstrates * */ { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); //int numEmployees=0; //use this as my counter int counter=0, idnum=0; Scanner keyboard = new Scanner(System.in); System.out.print("Enter ID number of employee, -1 to exit: "); idnum = keyboard.nextInt(); // REPEAT the next block until user enters -1 as idnum while(idnum != -1) { counter++; System.out.printf("Enter hours and rate for employee #%d: ",idnum); int hoursWorked=scanner.nextInt(); double payPerHour=scanner.nextDouble(); // calculate pay double weeklySalary=0.0; if (hoursWorked > 40) { System.out.println("You worked overtime!"); // now let's calculate weekly salary with 1 1/2 pay for overtime weeklySalary = (hoursWorked-40)*1.5*payPerHour+40*payPerHour; } else { weeklySalary = hoursWorked * payPerHour; } System.out.printf("Weekly salary for employee #%d is: $%.2f. You worked %d " + "hours at %.2f rate.\n", idnum, weeklySalary,hoursWorked, payPerHour); System.out.print("Enter ID number of employee, -1 to exit: "); idnum = keyboard.nextInt(); } } }