Question: C++ : Modify the class Time of figures 1 and 2 (below) to include a tick member function that increments the time stored in a

C++ :

Modify the class Time of figures 1 and 2 (below) to include a tick member function that increments the time stored in a Time object by one second. The Time object should always remain in a consistent state. Write a program that tests the tick member function. Be sure to test the following cases: Incrementing into the next minute; Incrementing into the next hour; Incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM).

Need a working code with screenshot, thanks

C++ : Modify the class Time of figures 1 and 2 (below)

to include a tick member function that increments the time stored in

a Time object by one second. The Time object should always remain

Fig 1. Time class containing a constructor with default arguments I /I Fig. 9.4: Time.h 2 I/ Time class containing a constructor with default arguments. 3 / Member functions defined in Time.cpp 5 // prevent multiple inclusions of header #1 fndef TIMEH - 7 #define TIME H 9 II Time class definition 10 class Time 12 public: 13 14 15 16 void setTime int, int, int // set hour, minute, second 7 void setHour int II set hour (after validation) 18 Void setMinute int 11/ set minute (after validation) 19 Void setSecond int; 1/ set second (after validation) 20 explicit Time( int-o, int-o, int = 0 ); // default constructor // set functions // get functions 22 unsigned int getHourO const; I/ return hour 23 24 25 26 void printUniversalO const; // output time in universal-time format 27 void printStandard) const; /I output time in standard-time format 28 private: 29 unsigned int hour 10 23 (24-hour clock format) 30 unsigned int getMinuteO const; I/ return minute unsigned int getSecond const; // return second unsigned int minute; // 0 59 unsigned int second; /70-59 I/ end class Time 32 34 #endif Fig 2. Member-function definitions for class Time I / Fig. 9.5: Time.cpp 2 // Member-function definitions for class Time. #include 4 #include 5 #include 4 #include 5 #include

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!