So I am working on a project that will take command line arguments (ex: 11:45:12 11:48:13) and output in the form "Elapsed time in seconds is: 181"
Though I am having difficulty changing my code from asking the user to "start" the timer by hitting any key, to getting the direct time from the command line argument. Any assistance is greatly appreciated! Below are my two classes Clock, and TestClock. testClock is the one that will be run with the command line arguments.
import java.sql.Time;
public class Clock {
public Time startTime;
public Time endTime;
Clock() {
} public void start(String startTime){
startTime.startTime(convertToSeconds(startTime));
} public void stop(String endTime){
endTime.setTime(convertToSeconds(endTime));
}
import java.util.Scanner;
public class TestClock {
public static void main(String args[]){
Clock cl = new Clock();
cl.start(args[0]);
cl.stop(args[1]);
System.out.println("Time elapsed is " + cl.getElapsedTime() + " seconds");
}
}
Still receiving error unable to convert to seconds is not able to be found. Same with get elapsed time.