User Tools

Site Tools


clock

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revisionBoth sides next revision
clock [2019/05/16 10:23] – created frchrisclock [2019/05/16 10:26] frchris
Line 1: Line 1:
-Make a clock class which has three int instance variables for hours, minutes and seconds.  It should also hale a 'tick()' method that advances the time by adding to the seconds.  If there is more than 59, it should go back to 0, and advance the minutes.  If there are more than 59 minutes, it should go back to 0, and advance the hours.  If there are more than 23 hours, it goes back to 0.  The Clock tester class below can be used to check your work.+Make a clock class which has three int instance variables for hours, minutes and seconds.   
 + 
 +It should also hale a ''tick()'' method that advances the time by adding to the seconds.  If there is more than 59, it should go back to 0, and advance the minutes.  If there are more than 59 minutes, it should go back to 0, and advance the hours.  If there are more than 23 hours, it goes back to 0.   
 + 
 +It needs a ''toString'' method that returns a string that has leading zeros ( as in "00:07:05"
 + 
 +The Clock tester class below can be used to check your work.
  
 {{ ::clocktester.java |}} {{ ::clocktester.java |}}
  
 What else? What else?
-  - Make a subclass of your Clock class called FancyClock that keeps track of days and/or milliseconds +  - Make a subclass of your ''Clock'' class called ''FancyClock'' that keeps track of days and/or milliseconds.  The ''toString'' method needs to be adjusted as well.  
-  - Make a subclass of your Clock class called AlarmClock.  The tick method needs to be enhanced so it checks to see if the alarm should be turned on+  - Make a subclass of your ''Clock'' class called ''AlarmClock''.  The tick method needs to be enhanced so it checks to see if the alarm should be turned on.
clock.txt · Last modified: 2019/05/16 14:23 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki