I need my code corrected to output as well as the start and stop time

I need my code corrected to output as well as the start and stop time

arguments entered as well as the elapsed time. Please read the assignment description and my code. I also attempted to create an absolute value on my time elapsed output, but it is showing an error. This is not a neccessary part of the assignment, so it can be taken out. But if you can fix this, I’d appreciate it. Also, please include a screenshot using  11:30:45 and 12:15:45 arguments to show the code is working. Thank you!

/**Purpose: Create Clock class that will run start and stop time.*Program will run elapsed time and will exit if invalid time is*entered.*/package clock;//import Java Time classesimport java.time.LocalDateTime;import java.time.LocalTime;//declare class Clock and declare variablespublic class Clock{private LocalTime startTime;private LocalTime stopTime;//create constructorpublic Clock(){startTime = LocalTime.now();}//resets the startTime to the given time// @param time: start timepublic void start(LocalTime time){startTime = time;}//sets the endTime to the given time//@param time: stop timepublic void stop(LocalTime time){stopTime = time;}//Math.abs class used to ensure positive//time run for any argument enteredpublic int getElapsedTime(){int hour=Math.abs(stopTime.getHour()-startTime.getHour());int min=Math.abs(stopTime.getMinute()-startTime.getMinute());int sec=Math.abs(stopTime.getSecond()-startTime.getSecond());//converts min and hour to secreturn sec+min*60+hour*60*60;}}
Background image of page 1

Need your ASSIGNMENT done? Use our paper writing service to score good grades and meet your deadlines.


Order a Similar Paper Order a Different Paper