Question: Please create a C++ class called myDate. It should have the following operations: myDate() default constructor. This will set the date to May 10, 1959.

Please create a C++ class called myDate. It should have the following operations:

myDate() default constructor. This will set the date to May 10, 1959.

myDate(int M, int D, int Y) overloaded constructor. This will set the date to the values passed in through the parameter list represented by Month, Day and Year.

void display() display the date in the following format (May 11, 1959) Do NOT print a linefeed after the date.

void incrDate(int N) increment the date by N days.

void decrDate(int N) decrement the date by N days.

int daysBetween(myDate D) return the number of days between this date and the date D. If date D is a future date, the return value will be a positive int. If date D is in the past, the return value will be a negative int.

int getMonth() return the month in integer form

int getDay() return the day of the month

int getYear() return the year

int dayOfYear() - return the number of days since the current year began. Example Jan 1 is 1, Feb 1 is 32.

string dayOfWeek() returns Monday, Tuesday, etc according to the day of the week.

Consider the overloaded constructor, if any invalid data is passed to this constructor, ignore all data and set the values to the default date.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!