Results 1 to 2 of 2
- 09-30-2010, 01:50 AM #1Member
- Join Date
- Sep 2010
- Rep Power
How to read user input in hh:mm:ss without time class
I am trying to design and implement a Java application that calculates and displays the elapsed time between two time values expressed in the 24-hour notation with the form hh:mm:ss. Assuming that the two times occur on the same day and that the “start” time occurs before the “finish” time. A typical program execution would look like the following:
Enter the start time (hh:mm:ss): 07:10:50
Enter the finish time (hh:mm:ss): 13:45:09
Elapsed Time = 06:34:19
I am not to use any of the Java Time Class functions. This is an exercise in string processing and algorithm development. The output should be formatted as shown(hh:mm:ss). The appropriate leading zeros need to be included.
The question is: What commands do I use to read in the time in hh:mm:ss format without using a Java Time Class function?
I've tried Scanner sc = new Scanner (System.in);
It is not working and I don't know how to handle the colons.:confused:
Any help is appreciated.
Last edited by lbayne; 09-30-2010 at 02:09 AM.
- 09-30-2010, 02:36 AM #2
- By varunb in forum New To JavaReplies: 12Last Post: 07-09-2010, 12:50 PM
- By Alvaro in forum New To JavaReplies: 7Last Post: 01-16-2010, 12:02 AM
- By yuvarani in forum New To JavaReplies: 3Last Post: 12-16-2009, 01:19 PM
- By daletron3030 in forum New To JavaReplies: 7Last Post: 01-16-2009, 06:24 AM
- By Smirre in forum New To JavaReplies: 8Last Post: 11-20-2008, 02:15 PM