Question: Given the following date class interface: class date {private: int month;//1 - 12 int day;//1 - 28. 29. 30. 31 depending on month & year
Given the following date class interface: class date {private: int month;//1 - 12 int day;//1 - 28. 29. 30. 31 depending on month & year int year;//4-digit, e.g.. 2017 public: date();//Default constructor (investigate; find what it is used for)//Postcondition: the newly declared date object is initialized to 01/01/2000 date(int mm, int dd, int yyyy);//Second constructor//Postcondition: the newly declared data object is initialized to mm/dd/yyyy void setDate(int mm. int dd. int yyyy);//Postcondition: set the contents of the calling date object to the values passed to the function void displayDateV1();//Postcondition: display the calling date object in mm/dd/yyyy format, e.g., 02/22/2017 void displayDateV2();//Postcondition: display the calling datecobject in the format like: February 22. 2017 int compareDates(date &dObj);//compares the two date objects: the calling one the dObj that is passed to the function//Postcondition: returns - 1. 0. or 1 if the calling date object if less than, equal to, or greater than dObj. respectively.}; Your are asked to: Implement all six member functions: Write a main() function containing C++ code to test all six member functions. Note that for the compareDates function, you must test all three possibilities! Format you program output so make it easily readable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
