Creaate a class called date that has integer data members


Problem

Creaate a class called Date that has integer data members to store month, day, and year. The class will only have a single 3-parameter constructor which allows the date to be created by specifying the numerical month, day, and year. If the user creates a Date object when any of the values passed are invalid, an invalid argument exception should be thrown with appropriate text:

a) The month must be a valid month (1-12),
b) The day must be in the appropriate range for that month (do not worry about leap years), and
c) The year must be between 1900 and 2020.

Include mutator methods for setting the month, day, and year. These should also throw invalid parameter exceptions if invalid parameters are provided. Include a toString() method that returns the date in the format "Month DD, YYYY" (ex: August 22, 1984).

Create a program that utilizes this class to creaate and display dates based on user input. Utilize try-catch blocks to validate the user input. Ensure that the exception thrown includes appropriate text to describe the problem (e.g. "Invalid Value - there are only 28 days in February" or "There are only 12 months in the year"). Demonstrate usage of the class and its embedded exception handling in a program that prompts users for initial date values, creates a date object, and then prompts the user to change the month, change the day, and change the year.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Creaate a class called date that has integer data members
Reference No:- TGS03297749

Expected delivery within 24 Hours