Problem

Complete the following tasks:a. Create a DateException that descends from the built-in run...

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.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT