Name: _____________________________ Honor Code Acknowledgment: ________________________ Random Quiz # 10 CPS 08, Spring 1995 March 1, 1995 Problem 1 : Elephants and Fences The declaration of the ClockTime class is partially reproduced below class ClockTime { public: ClockTime(int h = 0, int m = 0, int s = 0); int Hours() const; int Minutes() const; int Seconds() const; ClockTime & operator +=(const ClockTime & ct); private: int hours; int minutes; // constrained: 0-59 int seconds; // constrained: 0-59 }; The definition ClockTime time(0,80,79); defines a variable time whose internals are "not good", i.e., the value of minutes will be 80 (not between 0 and 59) and the value of seconds will be 79 (not between 0 and 59). Write a member function Normalize that can be called to set the values of hours, minutes, and seconds appropriately. For example, the constructor could be written as shown below ClockTime::ClockTime(int h, int m, int s) // postcondition: all data fields initialized { hours = h; minutes = m; seconds = s; Normalize(); } The member function for operator += could be written as shown below. ClockTime & ClockTime::operator += (const ClockTime & ct) // postcondition: add ct, return result (normalized for minutes, seconds) { seconds += ct.seconds; // add seconds minutes += ct.minutes; // add minutes hours += ct.hours; // add hours Normalize(); // fix up overflow return *this; } Write the function below: void ClockTime::Normalize()