class MonthInfo
{
public:
// Return a string of length three
representing
// the month (with is 1-12) and
vice-versa
// Provide a reasonable return value
in case of errors.
static string getMonth( int month );
static int getMonth( const
string & month );
static int daysInMonth( int month, int year );
private:
static bool isLeapYear( int year
);
static const string monthArray[ ];
};
// Provide any preprocessor directives, including the #ifndef/#endif
trick
class Date
{
public:
// Provide three constructors.
// One takes no parameters, the other two take
// a month, day, and year, in that order. One
of these three-parameter
// constructors takes the month as an integer,
while the other
// takes it as a string.
// Provide a setDate method that takes three
integers:
// the month, day, and year. There is no return
value.
// Provide a printDate method that takes an output
stream.
// There is no return value.
// Provide an equals and a lessThan method. Each
take
// another Date object and return a bool.
// Provide a daysBetween method that takes another
Date object
// and returns the number of days between them.
// (The number is positive if the current Date
is after the parameter Date.
// Provide a dateAfter method that returns the
Date after the current Date.
// Note: the current Date is unchanged.
// Provide a futureDate method that returns the
Date in the future.
// It takes one parameter that tells how many
days in the future to look.
// If the parameter is negative treat it as
a zero.
// Note: the current Date is unchanged.
// Provide a toString method as in Java.
private:
// Provide three data members: the month, day,
and year, represented
// as integers. The month will range from 1-12,
the day from 1-31, and
// the year from 1600 onwards.
};
In addition to the class methods specified, overload global operator<< to output a Date, and also overload the two equality and four relational operators (as non-class methods). Also, provide an overloaded operator+ and operator- consistent with futureDate and daysBetween. Make operator+ and operator- class methods. Because all of these overloaded operators can be implemented by calling public (named) Date methods, you should not need to use any friend declarations. Simply list each of these methods as declarations in the Date.h file and provide implementations (mostly one liners) in the Date.cpp file.