/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Define member functions of class dateType.
// This is file dateType.cpp.
#include "dateType.h" // gain access to specification of class
void dateType::initialize(int newMonth,
int newDay, int
newYear)
// Post: year is set to NewYear.
// month is set to newMonth.
// day is set to newDay.
{
year = newYear;
month = newMonth;
day = newDay;
}
int dateType::monthIs()
// Accessor function for data member month.
{
return month;
}
int dateType::yearIs()
// Accessor function for data member year.
{
return year;
}
int dateType::dayIs()
// Accessor function for data member day.
{
return day;
}
relationType dateType::comparedTo(dateType aDate)
// Pre: Self and aDate have been initialized.
// Post: Function value = LESS, if self comes before aDate.
// = EQUAL, if self is the same as aDate.
// = GREATER, if self comes after aDate.
{
if (year < aDate.year)
return
LESS;
else if
(year > aDate.year)
return
GREATER;
else if
(month < aDate.month)
return
LESS;
else if
(month > aDate.month)
return
GREATER;
else if
(day < aDate.day)
return
LESS;
else if
(day > aDate.day)
return
GREATER;
else
return
EQUAL;
}