public class Date {

  //representation of the objects of the class
  private int day;
  private int month;
  private int year;

  public Date(int d, int m, int y) {
    day = d;
    month = m;
    year = y;
  }

  public int day() {
    return day;
  }

  public int month() {
    return month;
  }

  public int year() {
    return year;
  }

  //overriding of the methods inherited from Object
  public String toString() {
    return ((day < 10)? "0" + day : Integer.toString(day)) + "/" +
      ((month < 10)? "0" + month : Integer.toString(month)) + "/" + year;
  }

  //deep equality test
  public boolean equalTo(Date d) {
    return day == d.day && month == d.month && year == d.year;
  }

  //test if a date precedes another one
  public boolean precedes(Date d) {
    return
      (year < d.year) ||
      (year == d.year && (month < d.month ||
                          (month == d.month && day < d.day)));
  }
}
