Question: Submit the C++ codes for the following requirements in one text file with an extension of .txt; a) Write a C++ class called Clock for

 Submit the C++ codes for the following requirements in one text

Submit the C++ codes for the following requirements in one text file with an extension of .txt; a) Write a C++ class called Clock for dealing with the daytime represented by hours, minutes, and seconds. Your class must have the following features: 1. Three instance variables for the hours (range 0 - 23), minutes (range 0 - 59), and seconds (range 0 - 59). 2. Two constructors: i. default (with no parameters passed; should initialize the represented time to 12:0:0) ii. a constructor with three parameters: hours, minutes, and seconds. 3. Instance functions: i. Functions getHours, getMinutes, getSeconds() with no parameters that return the corresponding values. ii. Functions setHours(), setMinutes(), setSeconds() with one parameter each that set up the corresponding instance variables. Function tick with no parameters that increments the time stored in a Clock object by one second iv. A function printClock0 that would print the time stored a Clock object using the standard time. For example, if a clock object time has an hours 18. minutes 35, seconds = 50 then this function should print the following: Time: 06:35:50 PM V. Function addClocks that would accept two objects of type Clock as parameters. This function should return a new created Clock object that has the result of the addition of the two times in these two received parameters

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!