java.lang.Object Clock
public class Clock
Talking Robot:
The Clock class is a "stub" for a class that should return the
hour of the current time of day as represented by a 24-hour clock
(in other words, in the range of 0 .. 23). An object of this class,
however, can be set to generate random times for testing purposes,
instead of always returning the current hour, or can be set to return
times from a pre-defined set of test cases.
Created:
17 December 2015, Alyce Brady
Constructor Summary | |
---|---|
Clock()
Construct a clock that knows about the current time. |
Method Summary | |
---|---|
java.lang.String |
getHH()
Returns the current hour in 12-hour HH format (01 - 12). |
int |
getHour()
Returns an hour in the range of 0 - 23. |
int |
getMinute()
Returns a minute in the range of 0 - 59. |
java.lang.String |
getMM()
Returns the current minute in MM format (00 - 59). |
void |
setHour(int hour)
Sets the time to an hour in the range of 0 - 23. |
void |
setMinute(int minute)
Sets the time to a minute in the range of 0 - 59. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Clock()
Method Detail |
---|
public java.lang.String getHH()
public int getHour()
public int getMinute()
public java.lang.String getMM()
public void setHour(int hour)
hour
- hour to set the clock to (0 - 23)public void setMinute(int minute)
minute
- minute to set the clock to (0 - 59)