Write a program that reads in a time of form hour and minute


Problem:

Question- Write a program that reads in a time of the form hour:minute, validates the input and prints the time in the form hh:mm AM or hh:mm PM. You may assume that hour and minute are numbers. The input is in military time: that is, it goes from 0 hour to 23 hours.
Your program must check for invalid conditions such as negative hour or minute, wrong values such as 24 for the hour value or 60 for minutes.
The program works as follows:
Enter time: 9:5
09:05 AM
Enter time: 0:-7
Minute should not be less than 0
Enter time: 12:59
12:59 PM
Enter time: 13:00
01:00 PM

Write the code step by step and explain it.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program that reads in a time of form hour and minute
Reference No:- TGS0893453

Expected delivery within 24 Hours