/** * Representation of a generic employee. * This class needs to be extended to create specific employee classes * @author Hal Perkins * @version CSE143 lecture example, sp03, sp06 */ public abstract class Employee { // instance variables private String name; // employee name private int id; // employee id number /** * Construct a new employee with the give name and id number * @param name Employee's name * @param id Employee's id number */ public Employee(String name, int id) { this.name = name; this.id = id; } /** * Return the name of this employee * @return Employee name */ public String getName() { return name; } /** * Return the id number of this employee * @return Employee id number */ public int getId() { return id; } /** * Return whether this employee is happy * @return true if employee is happy, false if not */ public boolean isHappy() { // we have happy employees return true; } /** * Return this employee's attitude * @return a string with employee name and whether he/she is happy */ public String getAttitude() { String result = getName() + " is "; if (!isHappy()) { result = result + "not "; } result = result + "happy"; return result; } /** * Return the pay earned by this employee * @return Employee's pay for the current pay period */ public abstract double getPay(); }