Write the program that have the class dataType

Write the program that have the class dataType to implement the date in the program. Write the definitions of the function setDate, and the constructor so that the values of the month, day, and year are checked before storing the data into the data members. Add a function member, isLeapYear, to check whether the year is a leap year. The class dataType can perform the following operations on a date:
a. Set the month.
b. Set the day.
c. Set the year.
d. Return the month.
e. Return the day.
f. Return the year.
g. Test whether the year is a leap year.
h. Return the number of the days in the month. For example, if the date is 3-12-2011, the number of the days to be returned is 31, because there are 31 days in March.
i. Return the number of the days passed in the year. For example, if the date is 3-18-2011, the number of the days passed in the year is 77. Note that the number of days returned also includes the current day.
j. Return the number of days remaining in the year. For example, if the date is 3-18-2011, the number of days remaining in the year is 288.
k. Calculate the new date by adding a fix number of days to the date. For example, if the date is 3-18-2011 and the days to be added are 25, the new date is 4-12-2011.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.