Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Design and implement a class Date that implements the date in a program. The class has three integers' data members: day, month, and year. The
Design and implement a class Date that implements the date in a program. The class has three integers' data members: day, month, and year. The program should have the following functions: a- (4 pts) Create a function string set_date() to return the name of the month. For example, if the month-2, then the function should return February. (8 pts) Create a function void check_date(int,int,int)that checks if the entered date is valid or not. The function takes a month, day, and a year. A valid month is either positive or less than 12. The day is valid is it positive and less than 31. A valid year is positive and less than 2019. If any of the values is invalid, keep asking the user to reenter until he or she enters a correct one. This should be done for all three values. Note also that you should verify if the user enters unmatched values for month and day. An example of unmatched values can be 2 (February), 30, for example since February is only 28 days. Reminder that January, March, May, July, August, October, and December are 31 days the others are 30. Assume that February is 28 days for simplicity b- Once the user enters all three values correctly, set the month, day and year to the valid ones. Last call the set_dateO function inside this current function. c- (2 pts) Create One default and one overloaded constructor. The overloaded constructor should only call check_date () function inside of it. This way, the dates are constructed only if they validated
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started