public class EmployeeManager { public static final int MAX_SIZE = 20; private Payable[] employees; private int n = 0; public EmployeeManager() { employees = new Payable[MAX_SIZE]; } public void addEmployee(Payable p) throws Exception { if (n == MAX_SIZE) { throw new Exception("The University is Full"); } for (int i = 0; i < n; i++) { if (employees[i].getName().equals(p.getName())) { throw new Exception("An employee by this name (" + p.getName() + ") already exists"); } } employees[n] = p; n++; } public void payEmployee(String name, double hoursWorked, float payRate) throws Exception { for (int i = 0; i < n; i++) { if (employees[i].getName().equals(name)) { try { employees[i].setPayRate(payRate); double paid = employees[i].addHoursWorked(hoursWorked); System.out.println("Employee " + employees[i].getName() + " has been paid: $" + paid); } catch (Exception e) { System.out.println(e.getMessage()); } return; } } throw new Exception("An employee by name " + name + " does not exist and cannot be paid"); } public void payEmployee(String name, double hoursWorked) throws Exception { for (int i = 0; i < n; i++) { if (employees[i].getName().equals(name)) { try { employees[i].addHoursWorked(hoursWorked); } catch (Exception e) { System.out.println(e.getMessage()); } return; } } throw new Exception("An employee by name " + name + " does not exist and cannot be paid"); } public void printAll() { for (int i = 0; i < n; i++) { System.out.println(employees[i]); employees[i].printAccount(); } } }