Question: Write a C++ program that includes the following: Clock - hours: int - minutes: int - seconds: int + Clock() + Clock(hour_value: int, minute_value: int,
Write a C++ program that includes the following:
| Clock |
| - hours: int - minutes: int - seconds: int |
| + Clock() + Clock(hour_value: int, minute_value: int, second_value: int) + get_hours(): int const + get_minutes(): int const + get_seconds(): int const + display(): void const + tick(): void |
Define a class Clock in the header file Clock.h, the UML class diagram is following,
Impletment the class Clock in the file Clock.cpp.
The main function is contained in the file lab04.cpp. The main function,
Creates the object my_first_clock with the default constructor
Prompts user to enter hour_value, minute_value, and second_value
Creates the object my_second_clock using the constructor with parameters and setting attrubute values as three user input values
Displays the current times of my_first_clock and my_second_clock
Adds 61 seconds (ticks) to my_first_clock
Displays the current time of my_first_clock
Adds 3661 seconds (ticks) to my_second_clock
Displays the current time of my_second_clock
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
