Write a C++ program which contains aclass named Time having three datamembers .
ID: 3608170 • Letter: W
Question
Write a C++ program which contains aclass named Time having three datamembers.
The class must have
· A default and parameterizedconstructor
· show() method to display the time in proper formatlike HH:MM:SS on the screen
· get() method to get time from user
· Overloaded Plus (+) and Minus (-)operators
· A destructor
You will overload + and - operator forthis class.
In main program make 3 objects of theTime class time1,time2 and time3 and call theget() functions for time1 and time2 then performtime3 = tim1+time2 and then you will display time3 using itsshow() function.
Note1: While Adding the time keep inmind do not just add the hours into hours and minutes into minutesand seconds in seconds , e.g
10:25:10
+01:45:25
---------------------
11: 70: 35
Will not be correct, instead your codeshould add times like, Note that as number of minutes haveincreased 60, hour have been increased.
10:25:10
+ 01:45:25
-------------------
Explanation / Answer
Write a C++ program which contains aclass named Time having three datamembers .
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.