//--------------------------------------------------------------------
//
//  Laboratory 1                                           logbook.h
//
//  Class declaration for the Logbook ADT
//
//--------------------------------------------------------------------

// Deals with problems arising from accidental double inclusion of file
#ifndef LOGBOOK_H
#define LOGBOOK_H

#include <stdexcept>

using namespace std;

class Logbook
{
  public:

    // Constructor
    Logbook ( int month, int year )         // Create a logbook
        throw ( logic_error );

    // Logbook marking operations
    void putEntry ( int day, int value )    // Store entry for day
        throw ( logic_error );              
    int getEntry ( int day ) const          // Return entry for day
        throw ( logic_error );

    // General operations
    int getMonth () const;                  // Return the month
    int getYear () const;                   // Return the year
    int getDaysInMonth () const;            // Number of days in month

    // In-lab operations
    void displayCalendar () const;          // Display as calendar
    Logbook ()                              // Default constructor
        throw ( logic_error );
    void putEntry ( int value );            // Store entry for today
    int operator [] ( int day ) const       // Return entry for day
        throw ( logic_error );
    void operator += ( const Logbook &rightLogbook );
                                            // Combine logbooks
  private:

    // Facilitator (helper) function
    bool isLeapYear () const;               // Leap year?

    // In-lab facilitator function
    int getDayOfWeek ( int day ) const;     // Return day of the week

    // Data members
    int logMonth,      // Month covered by logbook
        logYear,
        entries[31];   // Logbook entries
};

#endif //LOGBOOK_H

