Question: The language is C++. This is a single question. Class Time defines a digital time in the form of HMS which defines a time by
The language is C++. This is a single question.


![by three integers: an integer in the range of [023] for the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f39b25d5bc7_99766f39b2540c54.jpg)
!["Hour" and two more integers in the range of (0,59] for the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f39b26a2d0f_99866f39b2622de0.jpg)
Class "Time" defines a digital time in the form of "HMS" which defines a time by three integers: an integer in the range of [023] for the "Hour" and two more integers in the range of (0,59] for the "Minute" and "Second". Fill in the blanks in the following code according to the specifications given below: 1. The "Time" class includes an exception class named "InvalidTimeException that extends the "exception" interface of the C++ standard library. According to the partial implementation given for this type: i. Implement an appropriate "parameterized" constructor for this type. ii. Override the "what() function of the "exception" class. This function returns a message as shown in the second sample run below. iii. Implement getter methods for all of the attributes of the class. 2. Implement a "parameterized constructor for the class "Time" with the default argument of "O" for all of its input parameters. The constructor throws an appropriate "InvalidTimeException" in case an invalid argument is passed to the function. 3. Implement a function to set the time. This function throws an exception of the type "InvalidTimeException" in case an invalid argument is passed to the function. 4. Overload the stream extraction operator (i.e. ">>") to extract a time in the format of "h:m:s" into the object: h, m, and 3 are the hour, minute, and second, respectively. It is assumed that the format of the input is correct; i.e. "h", "m", and "3" are integer values separated by exactly one colon. This function throws an exception of the type "InvalidTimeException" in case of extracting an invalid time. 5. Overload the stream insertion operator (i.e. "") to insert a time in the format of "h:m:" into an output stream; h, n, and 3 are the hour, minute and second, respectively. 6. Overload the increment operator (i.e. "++") to increment the time by one second. Only implement the requested format. 7. Write a program that reads the current time from the keyboard, increments it by one second, and displays the new time on the screen. In case of an error in the input, the program displays a message as shown in the following sample run on the screen. Two more sample runs of this program are also given for your reference. Enter the current time in the format of "h:m:s": 12:67:36 Error: The value 67 for the minute is not valid. Enter the current time in the format of "h:m:s": 12:59:45 One second passed! The time is: 12:59:46 Enter the current time in the format of "h:m:s": 23:59:59 One second passed! The time is: 8:0:0 Notes: . Use the "InvalidTimeException" type in your exception handling code. It is assumed that all the required header files are included in the file. . 7:39 PM Use the "InvalidTimeException" type in your exception handling code. It is assumed that all the required header files are included in the file. cla33 Time { public: cla33 InvalidTimeException : public public: InvalidTimeException (char c, int v) . i what const string* 3 = ; *3 = "Error: The value + " for the "; switch (error) { case 'h'; case 'H': ; break; case 'm'; case 'M': ; break; case '3': case IS!: ; } *3 += 13 not valid."; return . 3tr(); } ; } getError() getValue() private: char error; int value; Timel ) throw(InvalidTimeException) { // use the variable: "h", "m", and "S" if ) if 7 ) ) 11 Time ) throw (InvalidTimeException) { // use the variables "h", "m", and "9" if ) ) ; if ( ) ; : ; ; 1 operator++) { if ( ) second++; else { : if ( ) minute++; else { ; if ( 2 hour++; else void set (int , int mint 3) throw (InvalidTimeException) { Time temp (h, m, 3); ; } private: int hour; int minute: void set (int , int n, int s) throw (InvalidTimeException) { Time temp (h, m, 3); ; } ; private: int hour; int minute; int second: }; operator>>( in, t) throw // It is assumed that the format is correct -> h:m:s int h, m, 3; i ; ; ; t. ; } operator
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
