Question: This exercise covers the implementation of a class Timer. ( 1 ) It contains three private integer member variables, hours, minutes, and seconds. ( 2
This exercise covers the implementation of a class Timer.
It contains three private integer member variables, hours, minutes, and seconds.
It contains two constructors.
default constructor that sets the hours to be minutes to be and seconds to be
an overloaded constructor that takes three integers as input to set the hours, minutes, and seconds of the object
It contains the following functions in the public section of the class
void setHoursint; sets the hours with the input value
void setMinutesint; set the minutes with the input value
void setSecondsint; set the seconds with the input value
void start; starts the count down of the timer by reducing the value of seconds by every second
string toString; output the current time in a specific format
It contains three private or helper functions that update the current seconds, minutes, and hours to get the correct time
void reduceSeconds reduce the current value of seconds by if it is larger than otherwiseelse call the reduceMinutes function and set the current value of seconds to be
void reduceMinutes reduce the current value of minutes by if it is larger than otherwiseelse call the reduceHours function and set the current value of minutes to be
void reduceHours reduce the current value of hours by
Note: You should declare the Timer class with the above members in the "timer.h file, and provide the implementation of the respective member functions in the "timer.cpp file. The implementations of the start and toString functions are provided to you in the "timer.cpp function. Also, the main function is provided to you so that you do not need to implement it
You are encouraged to use your local IDE to complete this exercise, and modify the main function to enable a timer with different time period than seconds.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
