/* Basic 24-Hour Digital Clock ================================================================== An instance of this class represents a basic 24-hour digital clock It displays a 2-digit HOUR 00 .. 23 and a 2-digit MINUTE 00 .. 59 A new 24-Hour Digital Clock displays random HOUR and random MINUTE A 24-Hour Digital Clock may be manipulated in only 2 ways: The HOUR_BUTTON advances the HOUR by 1, or from 23 to 00 The MINUTE_BUTTON advances the MINUTE by 1, or from 59 to 00 ================================================================== Public Interface: Constructor DigitalClock24() Create a new Digital Clock, random time Accessors int getHour() Return the current value of the hour int getMinute() Return the current value of the minute Mutators void hourButton() Advance the current hour void minuteButton() Advance the current minute ================================================================== COP 2210 Summer 2016 */ import java.util.Random; public class DigitalClock24 { //**************************************************************** //Instance (State) Variables // 00 .. 23 // 00 .. 59 //Constructor: Initialize the state variables of this Digital Clock // to show a random initial time public DigitalClock24() { Random generator = new Random(); } //Override: Return an image of the state of this DigitalClock public String toString() { return super.toString(); } //Return a 2-digit image of any integer between 0 .. 99 // Examples: 00 01 .. 08 09 10 11 .. 99 private String twoDigits(int integer) { return ( integer < 10 ? "0" : "" ) + integer; } //**************************************************************** //Accessors: return the values of the instance variables //Return the current value of the hour instance variable //Return the current value of the minute instance variable //**************************************************************** //Mutators: update the values of the instance variables //Advance the hour by 1, or roll over from 23 to 00 //Advance the minute by 1, or roll over from 59 to 00 }