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.