Question: In C++ Exercise 07 Define a class named Date with three private data members named month (integer), day (integer), and year (integer) as follows: This

In C++ Exercise 07 Define a class named Date with three privateIn C++

Exercise 07 Define a class named Date with three private data members named month (integer), day (integer), and year (integer) as follows: This class has a private member function void checkDate() that validates a date as follows: - The month must be an integer value from 1 to 12. - The day must be an integer value from 1 to 31. - The year must be an integer value from 1960 to 2011. Function checkDate() calls the library function exit() to terminate the program if any of the above conditions is not satisfied. This class default constructor sets the month data member to 1, the day data member to 1, and the year data member to 1960: The default date is 1/1/1960. The class constructor with parameters calls function checkDate() to check the date after it has set the values for the data members month, day, and year. The class also has the following public member functions: void inputDate() that reads the values for the data members month, day and year, and then calls function checkDate( ) to check the date. void outputDate() that prints the date in the format: month/day/year. int getMonth(), int getDay(), and int getYear(). These functions return the value of the month data member, the value of the day data member, and the value of the year data member respectively. Place the definition of the class in the header file Date.h, and the definitions of the functions in the source file Date.cpp Note: the header files iostream, iomanip, cstdlib, and Date.h must be included in the source file Date.cpp

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!