Question: Include your class implementation listing. 2.-Need a program that creates a clocktype object and calls all the methods. Report the results of compiling and running
Include your class implementation listing.
2.-Need a program that creates a clocktype object and calls all the methods. Report the results of compiling and running the program.
Class ClockType is present in the slides attached. Do not implement any class of your own. Just use the ones present in the slides
??


class clockType public: //Place the function prototypes of the functions setTime, //getTime, printTime, incrementSeconds, incrementMinutes, //incrementHours, and equalTime as described earlier, here. clockType (int hours, int minutes, int seconds) ; //Constructor with parameters / /The time is set according to the parameters. / /Postconditions: hr = hours; min = minutes; sec = seconds 11 The constructor checks whether the values of hours, 11 minutes, and seconds are valid. If a value is invalid, 1 1 the default value 0 is assigned. clockType () ; //Default constructor with parameters / /The time is set to 00:00:00. / /Postcondition: hr = 0; min = 0; sec = 0void setTime (int hours, int minutes, int seconds) ; / /Function to set the time / /The time is set according to the parameters / / Postcondition: hr = hours; min = minutes; sec = seconds 11 The function checks whether the values of hours, 11 minutes, and seconds are valid. If a value is invalid, 11 the default value 0 is assigned. void getTime (int& hours, int& minutes, int& seconds) const; / /Function to return the time / / Postcondition: hours = hr; minutes = min; seconds = sec void printTime () const; / /Function to print the time / / Postcondition: Time is printed in the form hh:mm:ss. void incrementSeconds () ; / /Function to increment the time by one second / / Postcondition: The time is incremented by one second. 11 If the before-increment time is 23:59:59, the time 11 is reset to 00:00:00. void incrementMinutes ( ) ; void incrementHours () ; //Function to increment the time by one hour / / Postcondition: The time is incremented by one hour. 11 If the before-increment time is 23:45:53, the time 11 is reset to 00:45:53. bool equalTime (const clockType& otherClock) const; / /Function to compare the two times / /Postcondition: Returns true if this time is equal to 11 otherClock; otherwise, returns false private: int hr; / /stores the hours int min; / /store the minutes int sec; / /store the seconds }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
