public class CalEntry implements Keyed {

    private int year;
    private int month;
    private int day;
   
    // Time, on a 24-hour clock.  Eg 1830 means 6:30 pm.
    private int time;
    private String text;



    public CalEntry (int y, int m, int d, int t, String a) {

        year = y; 
        month = m; 
        day = d; 
        time = t; 
        text = a;
    }
   
   

    public void setText (String s) {

        text = s;
    }



    public double getKey () {

        double date = (year*10000) + (month*100) + day;
        return (double)(date*10000) + time;
    } 



    public Object clone () {

        return new CalEntry(year, month, day, time, text);
    }



    public boolean equals (CalEntry e) {

        return (year == e.year && month == e.month && day == e.day 
                && text.equals(e.text));
    }



    // Note to students: This method doesn't produce nice-looking dates
    // and times if a leading-zero is involved.  Eg instead of "12:01",
    // it would give us "12:1".  Don't worry about fixing that.

    public String toString () {

        int hr = time / 100;
        int min = time % 100;

        return (new Integer(day)) + "/" +
               (new Integer(month)) + "/" +
               (new Integer(year)) + " at " +
               (new Integer(hr)) + ":" +
               (new Integer(min)) + " -- " + text;
    }
}
