Question: In Java programming,thanks Write a program to Ask the user to enter a time in military time (24 hours). The input must be entered in

In Java programming,thanks  In Java programming,thanks Write a program to Ask the user to

Write a program to Ask the user to enter a time in military time (24 hours). The input must be entered in military format (xx:xx). The program will convert and display the equivalent conventional time (12 hour with AM or PM) for each entry if it is a valid military time. An error message will be printed if the entry is not a valid military time. Thinlk about how you would convert any military time between 00:00 and 23:59 into conventional time. Also think about what would be valid military times To be a valid time, the data must have a specific form. First, it should have exactly 5 characters. Next, only digits are allowed in the first two and last two positions, and that a colon is always used in the middle position. Next, we need to ensure that we never have over 23 hours or 59 minutes. When converting from military time to conventional time, we only have to worry about times that have hours greater tharn 12, and we do not need to do anything with the minutes at all. Keep in mind that 00:00 in military time is 12:00 AM (midnight) and 12:00 in military time is 12:00 PM (noon) Test out your program using the following valid input 00:00, 12:00, 04:05, 10:15, 23:59, 00:35 and the following invalid input 7:56, 15:78, 08:60, 24:00, 3e:33, 1:111

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!