Your instructor provides you with a class the definition file for a class called 'date' for which you have to write the implementation. In addition to the methods already provided in 'date.h', you are required to create member function that will compare two dates in order to find out if one is greater than, less than or equal to the other. The function should be called compareTo with the following signature:

int compareTo(date& otherDate) const;

The purpose of this function is to compare one date to another and return 1 if the otherDate is greater than the date being compared, 0 if they are equal, and -1 if the otherDate is less than the one being compared to.

Below you will find the functionality to some of the functions in your new class:

print() // display the date in the format MM/DD/YYYY
numberOfDaysPassed() // return the number of days passed in the year.
numberOfDaysLeft() // return the number of days left in the year.
incrementDate(int nDays) // increment the date by nDays.
isLeapYear() // return true if the year is leap otherwise returns false.

Create a program to test your new data type then using composition, create another class called 'person' to demonstrate your understanding of composition.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.