0

Need help with an assignment here are the instructions.

  1. Your Clock.java must be the class.
  2. Your ClockApp.java is the main program.
  3. Your clock will be a 24 hour clock
  4. You will create the following public member functions for the clock class.
    a. clock()
    //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
    //the parameters
    //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
  5. The ClockApp will then run the clock. You need to test all of the functionality you have built in.
  6. While testing the functionality create a loop and increment the seconds for a while.
2
Contributors
1
Reply
12
Views
3 Months
Discussion Span
Last Post by Derek_10
2

Do you have a specific question? I am not going to do the entire assignment for you.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.