Question: Using C++, Write a program that prompts the user to enter time in 12-hour notation. The program then outputs the time in 24-hour notation. Your

Using C++,

Write a program that prompts the user to enter time in 12-hour notation. The program then outputs the time in 24-hour notation. Your program must contain three exception classes: invalidHr, invalidMin, and invalidSec. If the user enters an invalid value for hours, then the program should throw and catch an invalidHr object. Similar conventions for the invalid values of minutes and seconds.

Sample Run Enter hours: 14 The value of hr must be between 0 and 12. Enter hours: -2 The value of hr must be between 0 and 12. Enter hours: 5 Enter minutes: 70 The value of minutes must be between 0 and 59. Enter minutes: 30 Enter seconds: -2 The value of seconds must be between 0 and 59. Enter seconds: 45 Enter AM or PM: AM 24 hour clock time: 5:30:45 

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!