import java.util.Scanner; public class Payroll8 /** This class demonstrates parallel arrays and partially filled arrays * Also, we used the counter as the array index. * added an array of Strings * */ { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int numEmployees=0; //use this as my counter final int SIZE=100; int[] idnums = new int[SIZE]; double[] hoursWorked = new double[SIZE]; double[] payPerHour = new double[SIZE]; String[] names = new String[SIZE]; double[] weeklySalary = new double[SIZE]; double totalWages=0.0; System.out.print("Enter ID number of employee, -1 to exit: "); idnums[0] = scanner.nextInt(); // REPEAT the next block until user enters -1 as idnum while(idnums[numEmployees] != -1) { System.out.printf("Enter hours and rate for employee #%d: ",idnums[numEmployees]); hoursWorked[numEmployees]=scanner.nextDouble(); payPerHour[numEmployees]=scanner.nextDouble(); names[numEmployees] = scanner.nextLine(); // calculate pay if (hoursWorked[numEmployees] > 40) { System.out.println("You worked overtime!"); // now let's calculate weekly salary with 1 1/2 pay for overtime weeklySalary[numEmployees] = (hoursWorked[numEmployees]-40)*1.5*payPerHour[numEmployees]+40*payPerHour[numEmployees]; } else { weeklySalary[numEmployees] = hoursWorked[numEmployees] * payPerHour[numEmployees]; } totalWages+=weeklySalary[numEmployees]; numEmployees++; System.out.print("Enter ID number of employee, -1 to exit: "); idnums[numEmployees] = scanner.nextInt(); } // fell out of loop, numEmployees should contain number of employees // that were processed System.out.println("The number of employees processed is: " + numEmployees + " and the total wages to pay is: " + totalWages); System.out.println("idnum name hoursWorked payPerHour weeklySalary"); for (int i=0; i