public class ClockedEmployee implements Measurable { //Instance Variables String idNumber; private int hours; private double rate; public double getMeasure() { return this.grossPay(); } //Constructors public ClockedEmployee(int hours, double rate) { this.idNumber = nextIdNumber(); this.hours = hours; this.rate = rate; } public ClockedEmployee(double rate) { this(0, rate); } //Accessors public String getIdNumber() { return this.idNumber; } public int getHours() { return this.hours; } public double getRate() { return this.rate; } //Method to calculate employee's gross pay amount public double grossPay() { return this.hours * this.rate + (this.hours > 40 ? (this.hours - 40) * this.rate * 0.5 : 0.0); } //Override public String toString() { return "DayWorker " + this.idNumber + " " + this.hours + " Hours @ $" + this.rate + "/hr"; } //Helper Method to generate a new ID-number private static int lastNumber = 7000000; private String nextIdNumber() { lastNumber++; String id = "" + lastNumber; return id.substring(0, 3) + "-" + id.substring(3, 5) + "-" + id.substring(5); } }