/* This file contains the interface for class Year.

------------------------------------------------------------------*/

#ifndef YEAR
#define YEAR

#include <iostream.h>                           // interactive I/O
#include <fstream.h>                            // file I/O
#include "Boolean.h"

enum YearName {YearUnderflow = -1,              // too-low error
               Freshman, Sophomore,             // 0-1
               Junior, Senior, Graduate,        // 2-4
               NumberOfYears,                   // 5
               YearOverflow = 5};               // too-high error

class Year
{            // -- the private section --
  YearName
    YearValue_;                                  // the data member

 public:     // -- the public section --

/********** member functions **********/
   /*----- Class constructor -----
      To initialize a declaration of a Day object.

      Precondition:  A Day object has been declared.
      Receive:       YearName value InitYear (default value of
                       Freshman)
      Postcondition: The data member of this Day object has been
                       initialized to InitYear.
   ---------------------------------------------------------------*/

   Year(YearName InitYear = Freshman) {YearValue_ = InitYear;}

   /*----- Data member extractor -----
      This function extracts the actual value of the Year object.
   ----------------------------------------------------------------*/
   YearValue(void) const {return YearValue_;}

   /*----- Assignment -----
      This function allows assignment between Year objects.
   ----------------------------------------------------------------*/
   Year& operator=(const Year& YearExp);

   /*----- Increment/Decrement -----
      These operations destructively increment/decrement
        a Year object.
   ----------------------------------------------------------------*/

   Year operator++(void);                      // prefix increment
   Year operator++(int);                       // postfix increment
   Year operator--(void);                      // prefix decrement
   Year operator--(int);                       // postfix decrement

   /*----- Successor/Predecessor -----
      These functions find the successor/predecessor of
        a Year object.
   ----------------------------------------------------------------*/

   Year Next(void) const;                       // next year
   Year Previous(void) const;                   // previous year

   /*----- Relational Operators -----
      These operators provide the six basic relational operators
        between two Year objects.
   ----------------------------------------------------------------*/

   friend Boolean operator==(                   //  equality
                             const Year& Left, const Year& Right);
   friend Boolean operator!=(                   //  inequality
                             const Year& Left, const Year& Right);
   friend Boolean operator<(                    //  less-than
                             const Year& Left, const Year& Right);
   friend Boolean operator<=(                   //  less-or-equal
                             const Year& Left, const Year& Right);
   friend Boolean operator>(                    //  greater-than
                             const Year& Left, const Year& Right);
   friend Boolean operator>=(                   //  greater-or-equal
                             const Year& Left, const Year& Right);

   /*----- Input/Output -----
      These functions provide normal stream input and output on
        a Day object.
   ----------------------------------------------------------------*/

   friend ostream& operator<< (ostream& Out, const Year& OutYear);
   friend istream& operator>> (istream& In, Year& InYear);
};
#endif
