Reference no: EM132297946
Program Description: Create the MilTime.h and MilTime.cpp files. Ensure that you do not accept an invalid amount of hours or seconds. Consider using a bool method so that you do not use cout statements within your MilTime class.
You will have two exceptions to throw: BadHour and BadSeconds. Throw the exceptions instead of using bool methods for setting values. Demonstrate the testing of your program by creating a main.cpp testing program. See example output below.
Specific Requirements:
Create exception classes for both BadHour and BadSeconds that each have a private variable to hold the bad data, along with any needed methods.
Throw BadHour if the #### format is invalid (outside of the range 0000 - 2359) Throw BadSeconds if the number of seconds is outside of the range 0-59 In main, use at least one try/catch block.
Be sure to test your program with several different invalid times to demonstrate that your exceptions work.
Example output: Enter a military time in the format #### and then the number of seconds: 2514 18 2514 is an invalid number for military time.
Enter a military time in the format #### and then the number of seconds: 2200 67 67 is an invalid number of seconds.
Enter a military time in the format #### and then the number of seconds: 0018 13 Success! That time equates to 12:18:13 Press any key to continue . . .