/**
  * This method should get called once every minute - it makes the clock display go one minute
  * forward.
  */
 public void timeTick() {
   minutes.increment();
   if (minutes.getValue() == 0) { // it just rolled over!
     hours.increment();
   }
   updateDisplay();
 }
 /** Update the internal string that represents the display. */
 private void updateDisplay() {
   displayString =
       (hours.getValue() != 0 ? hours.getDisplayValue() : "12")
           + ":"
           + minutes.getDisplayValue()
           + " "
           + (isAm ? "am" : "pm");
 }
 /** Set the time of the display to the specified hour and minute. */
 public void setTime(int hour, int minute) {
   hours.setValue(hour);
   minutes.setValue(minute);
   if (hours.getValue() < 1) {
     setTime(12, minute);
   }
   if (hours.getValue() > 12) {
     setTime(12, minute);
   }
   updateDisplay();
 }
 /**
  * Constructor for ClockDisplay objects. This constructor creates a new clock set at the time
  * specified by the parameters.
  */
 public ClockDisplay(int hour, int minute) {
   hours = new NumberDisplay(24);
   minutes = new NumberDisplay(60);
   setTime(hour, minute);
   if (hours.getValue() > 12) {
     setTime(12, minute);
   }
   if (hours.getValue() < 1) {
     setTime(12, minute);
   }
 }
 /** Set the time of the display to the specified hour and minute. */
 public void setTime(int hour, int minute) {
   hours.setValue(hour);
   minutes.setValue(minute);
   updateDisplay();
 }
 /** Update the internal string that represents the display. */
 private void updateDisplay() {
   displayString = hours.getDisplayValue() + ":" + minutes.getDisplayValue();
 }
 /** Set the time of the display to the specified hour and minute. */
 public void setTime(int hour, int minute, boolean isAm) {
   hours.setValue(hour);
   minutes.setValue(minute);
   this.isAm = isAm;
   updateDisplay();
 }
 /** Constructor for ClockDisplay objects. This constructor creates a new clock set at 12:00. */
 public ClockDisplay() {
   hours = new NumberDisplay(24);
   minutes = new NumberDisplay(60);
   hours.setValue(12);
   updateDisplay();
 }