//Employee.java

public class Employee implements Comparable<Employee>
{
    private String name;
    private int id;
    private int age;

    public Employee
    (
        String name,
        int id,
        int age
    )
    {
        this.name = name;
        this.id = id;
        this.age = age;
    }

    public String getName()
    {
        return name;
    }

    public int getId()
    {
        return id;
    }

    public int getAge()
    {
        return age;
    }

    public String toString()
    {
        return name + "\t" + id + "\t" + age;
    }

    //To sort by age
    public int compareTo(Employee other)
    {
        return age - other.age;
    }
}
/*
    //To sort by name
    public int compareTo(Employee other)
    {
        return name.compareTo(other.name);
    }

    //To sort by id
    public int compareTo(Employee other)
    {
        return id - other.id;
    }
*/
/*
    Note:
    Since Employee implements Comparable<Employee>
    it must provide a definition for the compareTo()
    method. But it can only provide one implementation,
    so we must choose to compare names, ids, or ages,
    since we can only make one kind of comparison in
    this way. At the moment we are comparing ages.
*/
