Question: Create a Time class to implement time of a day using the 24-hour clock standard with the attributes for hours, minutes, and seconds. Include the
Create a Time class to implement time of a day using the 24-hour clock standard with the attributes for hours, minutes, and seconds. Include the following: Default constructor with default parameters for hours, minutes, and seconds, all set to zero. Overloaded extraction operator that prompts a user to set the Time. Continuously prompt user if the entered value is not valid for a 24-hour clock. Overloaded insertion operator to display the Time in the form HH:MM:SS. Making sure that hours, minutes, and seconds are displayed as two digits when necessary. For example, 3 o'clock should display as 03:00:00, not 3:0:0 Overloaded prefix and postfix increment operators to increment the Time by one second. Overloaded subtraction operator that returns a Time object indicating the duration between two Times. Overloaded == operator that returns true or false indicating that two Times are the same or not, respectively. Two Times are the same if they have equal values for hours, minutes and seconds. Write a main() function instantiating two Time objects and demonstrating that all the overloaded operators work correctly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
