public class Student implements Payable { private String name, school, major; private int year; private float payRate = 0; private double totalHours = 0; private double totalSalary = 0; public Student(String name, int year, String school, String major) { this.name = name; this.year = year; this.school = school; this.major = major; } public Student(String name, int year, String school) { this(name, year, school, "Undecided"); } public int getYear() { return year; } public String getSchoolName() { return school; } public String getMajorName() { return major; } public String toString() { return "Student " + name + " in school " + school + ", year " + year + ", with major " + major; } 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 void printAccount() { System.out.println(" Current hourly wage: $" + payRate + ", Total Salary: $" + totalSalary + ", Total Hours Worked: " + totalHours); } }