/** Time.h -----------------------------------------------------------
 This header file defines the data type Time for processing time.
 Basic operations are:
   Set:     To set the time
   Display: To display the time 
----------------------------------------------------------------------*/

#include <iostream>
using namespace std;

class Time
{
/******** Member functions ********/
public:

/***** Class constructors *****/

/* --- Construct a class object (default).
 *  Precondition:  A Time object has been declared.
 *  Postcondition: The Time object is initialized to 12:00 A.M.; 
 *                 that is, the myHours, myMinutes, and myAMorPM 
 *                 members are initialized to 12, 0, 'A', respectively,
 *                 and myMilTime to 0.
 **********************************************************************/

Time();

/* --- Construct a class object (explicit values).
 *  Precondition:  A Time object has been declared.
 *  Receive:       Initial values initHours, initMinutes, and 
 *                 initAMPM
 *  Postcondition: The myHours, myMinutes, and myAMorPM members 
 *                 of theTime object are initialized to initHours, 
 *                 initMinutes, and initAMPM , respectively, and 
 *                 myMilTime to the corresponding military time.
 **********************************************************************/

Time(unsigned initHours, unsigned initMinutes, char initAMPM);

/* Set sets the data members of a Time object to specified values.
 *
 *  Receive:  hours, the number of hours in standard time
 *            minutes, the number of minutes in standard time
 *            AMPM ('A' if AM, 'P' if PM
 *  Return:   The Time object containing this function with its
 *            myHours, myMinutes, and myAMorPM members set to hours,
 *            minutes, and am_pm, respectively, and myMilTime to
 *            the equivalent military time
 ********************************************************************/

void Set(unsigned hours, unsigned minutes, char am_pm);


/* Display displays time in standard and military format using
 * output stream out.
 *
 *  Receive:      ostream out
 *  Output:       The time represented by the Time object containing 
 *                this function
 *  Passes back:  The ostream out with time inserted into it
 ********************************************************************/

void Display(ostream & out) const; 
 
/***** Data Retrievers *****/

/* Hour Accessor
 *  Receive: The Time object containing this function (implicitly)
 *  Return:  The value stored in the myHours member of the Time
 *           object containing this function
 *****************************************************************/

unsigned Hour() const;

// and similar functions for myMinutes, 
// myAMorPM, and myMilTime retrieval


/********** Data Members **********/
private:
   unsigned myHours,
            myMinutes;
   char myAMorPM;        // 'A' or 'P'
   unsigned myMilTime;   // military time equivalent

}; // end of class declaration

//----- Definition of default constructor
inline Time::Time()
{
  myHours = 12;
  myMinutes = 0;
  myAMorPM = 'A';
  myMilTime = 0;
}

//----- Definition of Hour()
inline unsigned Time::Hour() const
{ return myHours; }

