public class Professor implements Payable { private String name, department; private boolean tenure; private float payRate = 0; private double totalHours = 0; private double totalSalary = 0; public Professor(String name, String department, boolean tenure) { this.name = name; this.department = department; this.tenure = tenure; } public Professor(String name, String department) { this(name, department, false); } public boolean hasTenure() { return tenure; } public String getDepartment() { return department; } public String toString() { return "Professor " + name + " in Department " + department + (tenure ? " TENURED" : " NOT TENURED"); } public String getName() { return name; } public double addHoursWorked(double h) throws Exception { if (h == 0) { throw new Exception("Cannot add zero (0) hours worked"); } else if (h < 0) { throw new Exception("Cannot add negative (" + h + ") hours worked"); } else if (payRate <= 0) { throw new Exception("Cannot use a zero or negative hourly (" + payRate + ") wage"); } double newSalary = h * payRate; totalSalary += newSalary; totalHours += h; return newSalary; } public void setPayRate(float dollars) throws Exception { if (dollars <= 0) { throw new Exception("Cannot set a zero or negative hourly (" + dollars + ") wage"); } this.payRate = dollars; } public double getSalaryTotal() { return totalSalary; } public String getAccount() { return " Current hourly wage: $" + payRate + ", Total Salary: $" + totalSalary + ", Total Hours Worked: " + totalHours; } }