Write a C++ program which contains a class named Time having threedata members.
ID: 3608040 • Letter: W
Question
Write a C++ program which contains a class named Time having threedata members.
·1 Hours
·2 Minutes
·3 Seconds
The class must have
·1 A default and parameterizedconstructor
·2 show() method to display the time inproper format like HH:MM:SS on the screen
·3 get() method to get time from user
·4 Overloaded Plus (+) and Minus (-)operators
·5 A destructor
You will overload + and - operator for this class.
In main program make 3 objects of the Time class time1, time2 andtime3 and call the get() functions for time1 and time2 then performtime3 = tim1+time2 and then you will display time3 using its show()function.
Note1: While Adding the time keep in mind do not just add the hoursinto hours and minutes into minutes and seconds in seconds ,e.g
10:25:10
+01:45:25
---------------------
11: 70: 35
Will not be correct, instead your code should add times like, Notethat as number of minutes have increased 60, hour have beenincreased.
10:25:10
+ 01:45:25
-------------------
12: 10: 35
: You will submit source code file only.
Explanation / Answer
x.x
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.