#ifndef TIME24_H
#define TIME24_H

#include <iostream>

using namespace std;

class Time24
{
   public:
      Time24(int h = 0, int m = 0);
         // constructor initializes hour and minute

      void AddTime(int m);
         // update time by adding m minutes to the current time
         // Precondition:  m must be >= 0 
         // Postcondition: The new time is m minutes later 

      Time24 Duration(const Time24& t) const;
         // return the length of time from the current time to some later
         // time t as a Time24 value
         // Precondition:  time t must not be earlier than the current time.
         // if it is, throw a rangeError exception

      void ReadTime(istream& in);
         // input from input stream time in the form hh:mm
         // Postcondition: Assign value hh to hour and mm to minute and 
         // adjust units to the proper range.

      void WriteTime(ostream& out) const;
         // display on output stream the current time in the form hh:mm


      int GetHour() const;
         // return the hour value for the current time
      int GetMinute() const;
         // return the minute value for the current time


   private:
      int myHour,     // 0-23 
	  myMinute;   // 0-59

      // utility function sets the hour value in the range 0 to 23
      // and the minute value in the range 0 to 59
      void NormalizeTime();     
};

#endif   // TIME24_H
