Question: b) Write a C++ main() function that should do the following: 1. Create a Clock object firstClock using the default constructor defined above. 2. Print
b) Write a C++ main() function that should do the following: 1. Create a Clock object firstClock using the default constructor defined above. 2. Print the time in firstClock using the function printClock(). 3. Tick the clock in the firstClock object ten times by applying its tick() function and printout the time after each tick using the function printClock(). 4. Create another Clock object secondClock using the second constructor defined above with the three integers (hours, minutes, seconds) that should be read from the keyboard. 5. Print the time in secondClock object using the function printClock(). 6. Tick the clock of the secondClock object ten times, printing the time after each tick using the function printClock(). 7. Call the function addClocks() to add the time in the firstClock object to the time in the secondClock object. Name the return object from this function call thirdClock. Then printout the time in thirdClock object using the function printClocko. 8. Change the time in the firstClock object to be (hours = 7 minutes = 23, seconds = 15) using the set functions defined above, then printout the time in this object. 9. Check if the two time objects firstClock and secondClock have the same time using the get functions defined above to check if they have the same hours, same minutes, and the same seconds. If so, printout the following message: firstClock and secondClock have the same time Otherwise, printout the following message: firstClock and secondClock do not have the same time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
