Need help with an assignment here are the instructions.
- Your Clock.java must be the class.
- Your ClockApp.java is the main program.
- Your clock will be a 24 hour clock
- You will create the following public member functions for the clock class.
//Default constructor with parameters
//Post: time is set to 00:00:00
//hr = 0; min = 0; sec = 0
b. clock(int hours, int minutes, int seconds)
//Constructor with parameters
//Post: The time is set according to
//hr = hours; min = minutes; sec = seconds
c. void setTime(int hours, int minutes, int seconds)
//Function to set the time
//Post: time is set according to the
//parameters: hr = hours; min = minutes; sec = seconds
d. void printTime()
//Function to print the time
//Time is printed in the form hh:mm:ss
e. void incrementSeconds()
//Function to increment the time by 1 second
//Post: The time is incremented by 1 second
//If the before-increment time is 23:59:59, the time
//is reset to 00:00:00
f. void incrementMinutes()
//Function to increment the time by 1 minute
//Post: The time is incremented by 1 minute
//If the before-increment time is 23:59:53, the time
//is reset to 00:00:53
g. void incrementHours()
//Function to increment the time by 1 hour.
//Post: The time is incremented by 1 hour.
//If the before-increment time is 23:45:53, time
//is reset to 00:45:53
h. bool equalTime(const clockType otherClock)
//Function to compare the two times
//Function returns true if this time is equal to
//otherClock; otherwise it returns false
- The ClockApp will then run the clock. You need to test all of the functionality you have built in.
- While testing the functionality create a loop and increment the seconds for a while.