Question: 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
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
Get step-by-step solutions from verified subject matter experts
