Question: Design and implement a C++ class called Date that has the following private member variables month (int) day (nt) . year (int Add the following

 Design and implement a C++ class called Date that has the

Design and implement a C++ class called Date that has the following private member variables month (int) day (nt) . year (int Add the following public member functions to the class. Default Constructor with all default parameters: The constructors should use the values of the month, day, and year arguments passed by the client program to set the month, day, and year member variables. The constructor should check if the values of the parameters are valid (that is day is between 1-31, month is between 1-12 and year is >0). If not, the constructor should use default values 1, 1, 2000 for month, day, and year respectively. . Accessors (getters): write one for each member variable month, day, and year. Mutators (setters): write one for each member variable month, day, and year. The mutators should check if the values passed are valid (that is day is between 1-31, month is between 1-12 and year is >0) and if not, do not update the member variable with an invalid value. . print1: this function should print the date in "month/day/year" format to the screen, where each month, day and year are int's. For example, "1/2/2012" print2: this function should print the date in "month day, year" format to the screen where day and year are int's and month is a string. For example, "January 2, 2012 b) to create at least two different Date objects and call both print1 and print2 functions, etc. Demonstrate the use of Date class by writing code in your main function. Make sure

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