*Please HELP me make a program that will determine a 24-hour equivalent from the given input:

Ex: 1:00pm - input
13:00 - output
5:45pm - input
17:45 - output..

*HELP Guyz..PLEASE..for our assignment..tnx alot..God Bless..

Votes + Comments
no we do not do homework for students without effort on their part
7 Years
Discussion Span
Last Post by Yangz_Seth

no will help you do your assignment for you.

if you are stuck post your code and we will help you.


Use the String class. Check its API. Try to recognize if it is am or pm. If it is am then the result is the input, if you remove the last 2 characters:
2:00am - input
2:00 - output

If it is pm, then just add 12 at the hour and then you are ok.

1:00pm - input
Find out if it is pm, then take the 1, then add 12 = 13 then print the 13 and the rest:

You can use the toChar method to convert the String to an array of characters. Then you can determine what is each character with if statements and calculate the result.

And then you can post some code with what you have so far

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.