Question: PROBLEM1 Write a program to calculate the number of seconds since midnight. For example, suppose the time is 1:02:05 AM. Since there are 3600 seconds

PROBLEM1 Write a program to calculate the number of seconds since midnight. For example, suppose the time is 1:02:05 AM. Since there are 3600 seconds per hour and 60 seconds per minutes, it has been 3725 seconds since midnight (3600 1 2 605 3725). The program asks the user to enter 4 pieces of information: hour, minute, second, and AM/PM. The program will calculate and display the number of seconds since midnight. [Hint: be very careful when the hour is 12] The following are some examples. Enter hour: 1 Enter minute: 2 Enter second: 5 Enter AM or PM: AM Seconds since midnight: 3725 Enter hour: 11 Enter minute: 58 Enter second: 59 Enter AM or PM: PM Seconds since midnight: 86339 Enter hour: 12 Enter minute: 7 Enter second: 20 Enter AM or PM: AM Seconds since midnight: 440 Enter hour: 12 Enter minute: 14 Enter second: 57 Enter AM or PM: PM Seconds since midnight: 44097
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
