import java.util.Date; /** * A skeleton Employee class. * * @author David Mutchler. * Created September 30, 2008. */ public class Employee implements Comparable { private int number; // unique number for each Employee private String lastName; private String firstName; private Date dateHired; private String title; /** * Construct an Employee with the given data. * * @param number A number that identifies the Employee uniquely * @param lastName Last name of the Employee * @param firstName First name of the Employee * @param dateHired Date that the Employee was hired * @param title Job title of the Employee */ public Employee(int number, String lastName, String firstName, Date dateHired, String title) { this.number = number; this.lastName = lastName; this.firstName = firstName; this.dateHired = dateHired; this.title = title; } /** * Return a negative number (indicating less than) * if this Employee has an employee number * that is less than the other Employee's number, * else returns a positive number (indicating greater than). * * @param otherEmployee Employee to be compared against this Employee * @return a negative number (indicating less than) * if this Employee has an employee number * that is less than the other Employee's number, * else returns a positive number (indicating greater than) */ public int compareTo(Employee otherEmployee) { return this.number - otherEmployee.number; } /** * Return a String that contains the data (fields) of this Employee. * * @return a String that contains the data (fields) of this Employee. */ @Override public String toString() { return this.number + " " + this.firstName + " " + this.lastName + " " + this.dateHired + " " + this.title; } }