Results 1 to 2 of 2
- 09-30-2010, 01:50 AM #1
Member
- Join Date
- Sep 2010
- Posts
- 1
- Rep Power
- 0
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);
...
sc.NextInt();
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
Similar Threads
-
Read user input into integer array
By varunb in forum New To JavaReplies: 12Last Post: 07-09-2010, 12:50 PM -
how to get input from User
By Alvaro in forum New To JavaReplies: 7Last Post: 01-15-2010, 11:02 PM -
To get time as input from user
By yuvarani in forum New To JavaReplies: 3Last Post: 12-16-2009, 12:19 PM -
Can't get my "if" statement to read user input
By daletron3030 in forum New To JavaReplies: 7Last Post: 01-16-2009, 05:24 AM -
Need help with calculating the time the user...
By Smirre in forum New To JavaReplies: 8Last Post: 11-20-2008, 01:15 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks