Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ First, design a class called Date. This simple class should store a date in three integers: month, day, and year. There should be member
C++
First, design a class called Date. This simple class should store a date in three integers: month, day, and year. There should be member functions to print the date in the following forms: 12/25/2014 or December 25, 2014 Date Exceptions You Date class must implement the following exception classes: InvalidDay Throw when an invalid day ( 31) is passed to the class. InvalidMonth Throw when an invalid month ( 12) is passed to the class. Input Validation: Do not accept values for the day greater than 31 or less than 1. Do not accept values for the month greater than 12 or less than 1. Demonstrate the class in a driver program that allows a user to enter a date at the console. User can enter numbers for day, month, and year. You Date class must be able to validate the information, and throw exceptions accordingly. If a validation rule is broken, throw an exception (one that matches the violation). When a correct date is entered, print the formatted output (described above) to the console. The Date class's print() function should do this - not main() or any other outside functions. Obviously, in order to fully demonstrate, your main() should is a try-catch block to properly handle any exceptions thrown by your Date class Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started