Extending Time and Appointment
Extend the Time class with the following methods:
- addMinutes(n), which adds n minutes to this Time. Take care to
make sure that the minutes field ends up within range.
- addHours(n), which adds n hours. It can wrap or throw an exception
if you pass midnight.
- equals(Time d), which checks Times this and d for equality
- compareTo(Time d), which returns -1, 0, 1 according to whether
this time occurs before, at, or after d.
Extend the Appointments class so that:
- An appointment has an additional field, "reminder time".
- The constructor already in the class sets the reminder time to the appointment
time
- There is another constructor which lets you specify the reminder time,
- and another one which lets you specify the duration between reminder and
appointment, and calculates the reminder time using Time.addMinutes().

© 2001 Mark Ryan and Alan Sexton