Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. public class ClockDisplay
  2. {
  3.     private NumberDisplay hour;
  4.     private NumberDisplay minute;
  5.  
  6.     public ClockDisplay()
  7.     {
  8.         hour = new NumberDisplay(23,23);
  9.         minute = new NumberDisplay(59,56);
  10.     }
  11.  
  12.     public void printTime()
  13.     {
  14.         System.out.println(hour.getValue() + ":" + minute.getValue());
  15.     }
  16.    
  17.     public void nextMinute()
  18.     {
  19.         if(minute.getValue() == minute.getMax())
  20.         {
  21.             if(hour.getValue() == hour.getValue())
  22.             {
  23.                 minute.forward();
  24.                 hour.forward();
  25.             }
  26.             else
  27.             {
  28.                 minute.forward();
  29.             }
  30.         }
  31.         else
  32.         {
  33.             minute.forward();
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement