Implement the date class using the class int members month, day, and year; the method setDate and the constructor must check if the parameters values of month, day, and year are valid before storing them into the data members.

Add the following operations on a date:

1.setDate method: Set month, date, and year
2.Set the month.
3.Set the day.
4.Set the year.
5.Return the month.
6.Return the day.
7.Return the year.
8.Test whether the year is a leap year.
9.Return the number of days in the month. For example, if the date is 3-12-2015, the number of days to be returned is 31, because there are 31 days in March.
10.Return the number of days passed in the year. For example, if the date is 3-18-2015, the number of days passed in the year is 77. Note that the number of days returned also includes the current day.
11.Return the number of days remaining in the year. For example, if the date is 3-18-2015, the number of days remaining in the year is 288.
12.Calculate the new date by adding a fixed number of days to the date. For example, if the date is 3-18-2015 and the days to be added are 25, the new date is 4-12-2015.
13.Return a reference to the object containing a copy of the date.
14.Make a copy of another date. Given a reference to an object containing a date, copy the data members of the object into the corresponding data members of this object.
15.Override to_String method; the method returns the date as "Month-Day-Year".

The class Date prints the date in numerical form. Some applications might require the date to be printed in another form, such as March 24, 2015. Derive the class ExtDate so that the date can be printed in either form.

Add a data member to the class ExtDate so that the month can also be stored in string form. Add a method to output the month in the string format followed by the yearfor example, in the form March 2015.

The program should be able to perform the following operations on an object of type:

1.Set the month
2.Set the date
3.Print the date as March 24, 2015
4.Print the date as March 2015
5.Override the super class method defined in part l; the new method calculates the new month. For example, if the current date is March 24, 2015 and we add ten days, the new month is April.
6.Add the appropriate constructors.

Design and implement the class Day that implements the day of the week in a program. The class Day should store the day, such as Sun for Sunday.

The program should be able to perform the following operations on an object of type Day:

7.Set the day.
8.Print the day.
9.Return the day.
10.Return the next day.
11.Return the previous day.
12.Calculate and return the day by adding certain days to the current day. For example, if the current day is Monday and we add four days, the day to be returned is Friday. Similarly, if today is Tuesday and we add 13 days, the day to be returned is Monday.
13.Add the appropriate constructors.

Using the classes ExtDate and Day, design the class Calendar so that, given the month and the year, we can print the calendar for that month. To print a monthly calendar, you must know the first day of the month and the number of days in that month. Thus, you must store the first day of the month, which is of the form Day, and the month and the year of the calendar. Clearly, the month and the year can be stored in an object of the form ExtDate by setting the day component of the date to 1, and the month and year as specified by the user. Thus, the class Calendar has two data members: an object of type Day and an object of type ExtDate.

Design the class Calendar so that the program can print a calendar for any month starting January 1, 1500. Note that the day for January 1 of the year 1500 was a Monday. To calculate the first day of a month, you can add the appropriate number of days to Monday, January 1, 1500. For the class Calendar, include the following operations:

1.Determine the first day of the month for which the calendar will be printed. Call this operation firstDayOfMonth.
2.Set the month.
3.Set the year.
4.Return the month.
5.Return the year.
6.Print the calendar for the particular month.
7.Add the appropriate constructors to initialize the data members.

Write a menu driven program to test the above classes. Print the calendar for either a particular month and year. For example, the calendar for September 2014 is:

The menu must include the following options: see image.

1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year
5: Print number of days gone in a year
6: Add number of days and print new date
7: Print Calendar
8: Save the date in a file
9: Terminate the program

Sample Output

Enter month, day, and year
11 1 2019
Welcome to the Calendar program. Choose among the following options: 1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year
5: Print number of days gone in a year
6: Add number of days and print new date 7: Print Calendar
8: Save the date in a file
9: Terminate the program
1
November 1, 2019
Welcome to the Calendar program. Choose among the following options:
1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year
5: Print number of days gone in a year
6: Add number of days and print new date 7: Print Calendar
8: Save the date in a file
9: Terminate the program
2
November 2019
Welcome to the Calendar program. Choose among the following options:
1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year
5: Print number of days gone in a year
6: Add number of days and print new date 7: Print Calendar
8: Save the date in a file
9: Terminate the program
3
Number of days in a month: 30
Welcome to the Calendar program. Choose among the following options:
1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year
5: Print number of days gone in a year
6: Add number of days and print new date 7: Print Calendar
8: Save the date in a file
9: Terminate the program
4
Days left in the Year: 60
Welcome to the Calendar program. Choose among the following options:
1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year
5: Print number of days gone in a year
6: Add number of days and print new date 7: Print Calendar
8: Save the date in a file
9: Terminate the program
5
Days gone in the year: 305
Welcome to the Calendar program. Choose among the following options:
1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year
5: Print number of days gone in a year
6: Add number of days and print new date 7: Print Calendar
8: Save the date in a file
9: Terminate the program
6
Enter the number of days to be added: 30
After increment date: December 1, 2019
Welcome to the Calendar program. Choose among the following options: 1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year 5: Print number of days gone in a year
6. 6: Add number of days and print new date
7. 7: Print Calendar
8. 8: Save the date in a file
9. 9: Terminate the program
7
Welcome to the Calendar program. Choose among the following options:
1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year
5: Print number of days gone in a year
6: Add number of days and print new date 7: Print Calendar
8: Save the date in a file
9: Terminate the program
8
Enter file name:
Data.txt
Welcome to the Calendar program. Choose among the following options:
1: Print date as month-day-year
2: Print date as month-year
3: Print number of days in a month
4: Print number of days left in a year
5: Print number of days gone in a year
6: Add number of days and print new date 7: Print Calendar
8: Save the date in a file
9: Terminate the program
9
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.