Class Clock

java.lang.Object
  extended by Clock

public class Clock
extends java.lang.Object

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

Version:
17 December 2015
Author:
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

Clock

public Clock()
Construct a clock that knows about the current time.

Method Detail

getHH

public java.lang.String getHH()
Returns the current hour in 12-hour HH format (01 - 12).

Returns:
the hour in HH format

getHour

public int getHour()
Returns an hour in the range of 0 - 23. Returns the current time of day, but is actually a random hour.)

Returns:
the hour

getMinute

public int getMinute()
Returns a minute in the range of 0 - 59. (Should be the hour of the current time of day, but is actually a random hour.)

Returns:
the minute

getMM

public java.lang.String getMM()
Returns the current minute in MM format (00 - 59).

Returns:
the minute in MM format

setHour

public void setHour(int hour)
Sets the time to an hour in the range of 0 - 23.

Parameters:
hour - hour to set the clock to (0 - 23)

setMinute

public void setMinute(int minute)
Sets the time to a minute in the range of 0 - 59.

Parameters:
minute - minute to set the clock to (0 - 59)