In this assignment the student should develop a month calendar by designing a class called
calendarType . This class uses two other classes (dateType and dayType) as described below:
1. dayType Class: This class has been designed by students in Lab1 exercises. Referee to it.
2. dateType Class: This class is designed and implemented to keep track of data. This class has
been provided it to you. Study it first then add definitions and implementations of the
following operations to this class:
Test whether the year is a leap year. Leap year is identified by 3 criteria :
The year is evenly divisible by 4;
If the year can be evenly divided by 100, it is NOT a leap year, unless;
The year is also evenly divisible by 400. Then it is a leap year.
Return the number of days in the month. For example, if the date is 12/3/2014, the
number of days to be returned is 31 because there are 31 days in March.
Return the number of days passed in the year. For example, if the date is 18/3/2014
the number of days passed is 77. Note that the number of days returned also includes
the current day.
Return the number of days remaining in the year. For example, if the date is
18/3/2014 , the number of days remaining in the year is 288.
Calculate the new date by adding a fixed number of days to the date. For example, if
the date is 18/3/2014 and the days to be added are 25, the new date is 12/4/2014.
To print monthly calendar using calendarType class, you must know the first day of the
month and the number of the days in that month. Thus, you must store the first day of the
month, which is in the form of dayType and the month and the year of the calendar. Clearly,
the month and the year can be stored as an object of the form dateType by setting the day
component of the date to 1, and the month and year as specified by user.
Design the class calendarType so that the program print a calendar for any month starting
1/1/ 1500 which is Monday. To calculate the first day of a month, you can add the 2
appropriate days to Monday of January 1, 1500. For this class identify and implement the
following operations:
Determine the first day of the month for which the calendar will be printed. Call this
operation firstDayOfMonth.
set/get month.
set/get year.
Print calendar for particular month.
Add the appropriate constructors to initialize the member variables.
Write a test program to print the calendar for either a particular year or a particular month
Please note, that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.
We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.