Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

I get this error when trying to run TestClock and Clock java file

I get this error when trying to run TestClock and Clock java file.<br/>Exception

in thread “main” java.lang.ArrayIndexOutOfBoundsException: 0
*********************************************************************
Need this portion below as well

*********************************************************************
Your deliverables include all Java files (.java) and a single word (or PDF) document. The Java files should be named appropriately for your applications. Your word document should include screen captures showing the successful compiling and running of each application, and a detailed description of the test plan for each application. The screen captures should document your use of the IDE. The test plan should include the input, expected output, actual output and if the test case passed or failed. Submit your files to the Homework 4 assignment area no later than the due date listed in the calendar.

import java.text.*;import java.util.*;public class Clock{private String startTime;private String stopTime;public Clock(){String time=String.valueOf((new Date().getTime()));this.startTime=time;}public void start(String startTime){this.startTime=startTime;}public void stop(String stop){this.stopTime=stop;}/**** Calculating time elapsed.* @return timeelapsed in seconds*/public int getElapsedTime(){//Calculating time Elapsed.String[] split = startTime.split(“:”);int starthours = Integer.valueOf(split[0])*3600;int startminutes = Integer.valueOf(split[1])*60;int startseconds = Integer.valueOf(split[2]);String[] end = stopTime.split(“:”);int endhr=Integer.valueOf(end[0])*3600;int endmin=Integer.valueOf(end[1])*60;int endsec=Integer.valueOf(end[2]);int totaltime=(endhr+endmin+endsec)-(starthours+startminutes+startseconds);return totaltime;}public static void main(String[] args) throws ParseException{//Getting startTime and stopTime from argClock newClock=new Clock();String startTime=args[0];String stopTime=args[1];//setting startTime and stopTime from argnewClock.start(startTime);newClock.stop(stopTime);System.out.println(“Elapsed time in seconds is:“+newClock.getElapsedTime());
Background image of page 1
}}
Background image of page 2
 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"