Question: Question 4 Consider the following class declaration: 4 COS 1 5 1 2 / 1 0 3 / 2 0 2 4 5 Implement and

Question 4
Consider the following class declaration:4COS1512/103/20245Implement and test the Date class, taking the following guidelines into account:a) The default constructor should initialise the date to 14 September 1752.b) The overloaded constructor should initialise the date with the given day, month and year.c) The functions getDay(), getMonth() and getYear() should return the current day, month and year respectively.d) The functions setDay(), setmonth() and setYear() should change the current day, month or year to the given value.e) The operator ++ should advance the date by one, and return the new date.f) The operator -- should set the date back by one day, and return the new date.g) The operator should calculate whether the receiving date object (left argument) precedes the parameter date (right argument).For example, Date (1,1,2002) Date(1,3,2002).h) The private member function monthLength () should return the length of the current month, taking into account leap years. A year is a leap year if it is either (i) divisible by 4, but not by 100, or (ii) divisible by 400. In a leap year, February has 29 days, otherwise it has 28 days.i) Also overload the insertion operator to output a date to the screen. For example, the date in (a) above should be written as: 14 September 1752.Test the Date class in a C++ program that will do the following:
Declare a new Date object called d1.
Display the day, month and year of d1 on the screen.
Change the date to 28 February 2000.
Advance this date by one and display the new date on the screen.
Now change the date to 1 January 2002. please answer in c++ only
Question 4 Consider the following class

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 Programming Questions!