Example 4 (2)
Possible contract, expressed as an interface:
public interface DateADT { // Each Date value is a past, present, or future date.
public int compareTo (Date that); // Return –1 if this date is earlier than that, // or 0 if this date is equal to that, // or +1 if this date is later than that.
public String toString (); // Return this date rendered in ISO format.
public void advance (int n); // Advance this date by n days (where n = 0).