Question: Files: Date.cpp & Date.h (or just Date.h) -mainDate.cpp Write the class Date as described in the UML diagram below. The default constructor sets month
Files: Date.cpp & Date.h (or just Date.h) -mainDate.cpp Write the class Date as described in the UML diagram below. The default constructor sets month to 1, day to 1, and year to 1899. In the non-default constructor and setDate function, validate the passed values before updating the member data. If the passed value for the day is 41, set the day member to 1. Also, if the passed value for the day is 30 and the month is 2, this is invalid and the day should be set to 1. The function addDays adds a number of days to the date and adjusts the member variables if the date goes to another month or year. -Add a member function the checks whether a year is a leap year. Demonstrate your class in main Date.cpp - month: int -day: int Date -year: int + Date() + Date (int, int, int) + setDate(int, int, int): void + addDays(int):void +getDay() const; int +getMonth() const; int +getYear const: int +printDate() const: void
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
