Question: 6 . In Programming Exercise 2 , the class dateType was designed and implemented to keep track of a date, but it has very limited
In Programming Exercise the class dateType was designed and
implemented to keep track of a date, but it has very limited operations.
Redefine the class dateType so that it can perform the following operations on a date, in addition to the operations already defined:
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 days in the month. For example, if the date is
the number of days to be returned is because there are
days in March.
i Return the number of days passed in the year. For example, if the date
is the number of days passed in the year is 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 the number of days remaining in the year is
k Calculate the new date by adding a fixed number of days to the date.
For example, if the date is and the days to be added are
the new date is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
