public class DateWithComparison implements Comparable // I implement my own basic Date class with the Comparable interface so that we { // can compare two Dates private int day, month, year; // instance data as we expect public DateWithComparison() // no-arg constructor, arbitrary chose the epoch for the date { day=1; month=1; year=1970; // this date is known as the epoch in Unix/Linux systems } public DateWithComparison(int d, int m, int y) // given the Date, set the values (note: I was too lazy to implement constructor { // that receives the Date as a String like "12/13/14") day=d; month=m; year=y; } // accessors public int getDay() {return day;} public int getMonth() {return month;} public int getYear() {return year;} // mutators - these could be implemented to test that the day is accurate given the month public void setDay(int d) {day=d;} // or that the month is between 1 and 12 public void setMonth(int m) {month=m;} public void setYear(int y) {year=y;} public String toString() // toString to return the Date using typical format like "12/13/2014" { // we could enhance this to write the Date like "December 13, 2014" return month + "/" + day + "/" + year; } // implement Comparable by a compareTo method public int compareTo(Object o) { int otherDay=((DateWithComparison)o).getDay(); // have to downcast o into a DateWithComparison int otherMonth=((DateWithComparison)o).getMonth(); int otherYear=((DateWithComparison)o).getYear(); if(year>otherYear) return 1; // test the years first, if this year < other year then this Date < other else if(yearotherMonth) return 1; // years are the same, test months else if(monthotherDay) return 1; // years and months are the same, test day else if(day