public class Employee2 { private final int employeeID; private final String[] names; private final double hourlyRate; // Note: This code assumes InvalidEmployeeException // is in the same package as this source code. public Employee2(final int id, final double hourlyRate, final String... names) throws InvalidEmployeeException { // set employeeID if (id <= 0) throw new InvalidEmployeeException("ID less than 1"); this.employeeID = id; // set hourlyRate if (hourlyRate < 0.0) throw new InvalidEmployeeException("Employee rate less than 0"); this.hourlyRate = hourlyRate; // set names (last name is required at a minimum) if (names == null || names.length < 1) throw new InvalidEmployeeException("Last name is missing"); this.names = (String[])names.clone(); } public int getID() { return employeeID; } public double getHourlyRate() { return hourlyRate; } public String getFirstName(final int pos) { // last position in array reserved for last name if (pos >= names.length-1) return null; else return names[pos]; } public String getLastName() { return names[names.length-1]; } public int getNumberOfFirstNames() { return names.length-1; } public String toString() { String result = "Employee: #" + employeeID + ", Name: "; for (int i=0; i