/** Instance: a person's name, year hired, and salary */ public class Employee { private String name; // Employee's name; cannot be null or empty private int start; // Year hired; -1 if undefined private double salary; // Salary. Must be >= 0 /** * Constructor: a person with name n, year hired d, salary s * Preconditions: n is neither empty nor null * d is > 1970 or -1 if undefined * s is >= 0 */ public Employee(String n, int d, double s) { name = n; start = d; salary = s; } /** * Constructor: a person with name n, year hired d, * salary 50,000 */ public Employee(String n, int d) { this(n, d, 50000); /**name= n; start= d; salary= 50000; */ } /** * Constructor: a person with name "":, year 2012, * and salary 0 */ public Employee() { this("", 2010, 0); } /** Yields: name of this Employee */ public String getName() { return name; } /** * Set the name of this Employee to n * Precondition: n is neither empty nor null */ public void setName(String n) { name= n; } /** Yields: year this Employee was hired */ public int getStart() { return start; } /** * Set the year this Employee was hired to y * Precondition: y is > 1970 or -1 if undefined */ public void setStart(int y) { start= y; } /** = Employee's total compensation (here, the salary) */ public double getCompensation() { return salary; } /** * Change this EmployeeÕs salary to d * Precondition: d >= 0 d */ public void changeSalary(double d) { salary= d; } /** Yields: String representation of this Employee */ public String toString() { return this.getName() + ", year " + getStart() + ", salary " + salary ; } /** Yields: toString value from superclass */ public String toStringUp() { return super.toString(); } /** Yields: Òe is an Employee, with the same fields as this Employee */ public boolean equals(Employee e) { return e != null && this.name.equals(e.name) && this.start == e.start && this.salary == e.salary; } /** Yields: equals from Object class */ public boolean equalsUp(Employee e) { return super.equals(e); } }