import java.util.Scanner; /** The Employee class will read in info about any number of * employees and caculate * the weekly salary for each employee. */ public class EmployeeV3 { public static void main(String[] args) { int numEmployees; System.out.println("Enter number of employees: "); Scanner sc = new Scanner(System.in); numEmployees = sc.nextInt(); sc.nextLine(); // skip \n in input buffer String name; double hours, rate; int count = 1; while (count <= numEmployees) { // Step 1: Read in name, hours, rate for employee 1 System.out.println("Enter employee name for employee#" + count +":"); name = sc.nextLine(); System.out.println("Enter hours and rate: "); hours = sc.nextDouble(); rate = sc.nextDouble(); System.out.println("Name: " + name + " hours: " + hours + " rate: " + rate); // Step 2: Calculate gross pay double pay; if (hours <= 40) { pay = hours * rate; } else { pay = 40 * rate + (hours-40)*1.5*rate; } System.out.println("gross pay is: " + pay); // Step 3: Subtract taxes from pay if (pay >= 1000){ pay -= .15 * pay; } else { pay -= .10 * pay; } System.out.println("net pay is: " + pay); sc.nextLine(); // skip '\n' in input buffer count++; }// end whle loop } }