Question: Write a program in C + + that will prompt user to enter the time in 1 2 - hour notation. Then program outputs the

Write a program in C++ that will prompt user to enter the time in 12-hour
notation. Then program outputs the time in 24-hour notation.
Your program must contain three Exception classes; InvalidHour, InvalidMinute
and InvalidSecond.
If user enters and invalid value for hour then program should throw and catch an
InvalidHour object. Do same for minutes and seconds.
A valid input for hour, minute and second in 24523 pm should display output
of 14:45:23 hours.
An hour can only has a value from 0 to 12 otherwise it is invalid.
A minute can only has a value from 0 to 60 otherwise it is invalid.
A second can only has a value from 0 to 60 otherwise it is invalid.
And finally a string to designate am or pm.
Test program to make sure it is working correctly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!