Complete the following tasks: a. Create a DateException that descends from the built-in runtime_error exception class. Include fields that hold a month, day, and year and include get functions for...



Complete the following tasks:


a. Create a DateException that descends from the built-in runtime_error exception


class. Include fields that hold a month, day, and year and include get functions for each of


the values.


b. Create a Date class. Data fields include month, day, and year. Include an exception function


that prompts for and accepts values for each of the data fields, and that throws a


DateException if the month is less than 1 or more than 12 and if the day is out of range


for the entered month. (Assume February can have 29 days.) Allow any value to be accepted


for the year. Also include an overloaded insertion operator to display a Date’s data values.


c. Write a main()function that instantiates at least five Date objects and accepts data for


each. When you run the program, provide data that tests that each type of exception is


being recognized. The main()function should catch the exceptions and display an appropriate error message about each including what the entered value was. If an exception is


caught, the data for the Date object should be set to the default date 1/1/2010. Save the file


as DateExceptions.cpp.



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here