Question: Language is C++ undefined 2. Time 24 Hours Language: C++ Autocomplete Ready Define a class Time24, that has the private time, minutes, and seconds attributes.
Language is C++
undefined
2. Time 24 Hours Language: C++ Autocomplete Ready Define a class Time24, that has the private time, minutes, and seconds attributes. It has following functions: - Time24(int h, int m, int s) initializes the attributes, also supports default values. - Time24(int h, int m, int s, char p) initializes the attributes given in 12 hours format. p is given as 'a' or 'p', indicating if it's am/pm. - void add(Time24 time) adds the time to the current time of object. - void adjust() to adjust the time to a valid 24 hours, this function should do the adjustment. For code re- utilization purposes this function can be called from constructor, and add function. (should it be a private function?? Yes, probably it should be define in private scope, as this will be used internally inside the class) - void show() displays the time in 24 hours format. Make this function constant, so that can be called with constant object. 1 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
