// Filename: Timer.h // #ifndef _Timer #define _Timer // Timer class: provides a countdown timer with minutes and seconds // timer does not go less than zero // // Construction: // a) a positive integer initializer specifies the number of minutes // and seconds // b) no initializer; timer set to zero // ******************** Public Operations ********************* // void set(int minutes, int seconds) // --> resets timer to minutes and possibly seconds // void print(ostream &os) const // --> prints minutes:seconds remaining to os // ostream & operator << (ostream & os, const Timer & t) // --> prints minutes:seconds remaining to os // void subtract(int minutes, int seconds) // --> subtracts minutes and seconds from timer // int outOfTime( ) --> returns 1 if timer has run out, 0 otherwise // By David Hutchens and Beth Katz #include class Timer { public: Timer(int minutes=0, int seconds=0); virtual void set(int minutes=0, int seconds=0); virtual void print(std::ostream & os) const; virtual void subtract(int minutes, int seconds); virtual int outOfTime( ) const; private: int theSeconds; }; std::ostream & operator << (std::ostream & os, const Timer & t); #endif