Okay so im new to java and I have this assignment that I started but I am now stuck
The instructions are:
Create an ElapsedTimeCalculator class that computes the amount of time that passes between a starting time and an ending time, in military format.
For example, suppose the two times are 1445 and 1730. Then the program output should look something like this:
Start time: 1445
End time: 1730
Exactly 2 hour(s) and 45 minute(s) have passed.
Total elapsed time in minutes: 165
Total elapsed time in hours: 2.75
ElapsedTimeCalculator Class Specifications:
1. Your class will have a constructor that takes two parameters: the starting time and the ending time in military format
2. Your class will also have these methods:
• “get” methods to return the starting and ending times
• a “set” method that resets the starting and ending times to values passed as parameters
• a method that returns the hour portion of the elapsed time
• a method that returns the minute portion of the elapsed time
• a method that returns the total elapsed time in minutes
• a method that returns the total elapsed time in hours
Now here below you can see what I have so far...
public class ElapsedTimeCalculator {
private int startTime, endTime;
private int hours;
private int minutes;
private int seconds;
//constructor
ElapsedTimeCalculator(int start, int end)
{
startTime = start;
endTime = end;
}
// “get” methods to return the starting and ending times
public int getStart()
{
return startTime;
}
public int getEnd()
{
return endTime;
}
//a “set” method that resets the starting and ending times to values passed as parameters
public void setElapsedTimeCalculator()
{
}
private void reset() {
if (startTime > 0 && endTime > 0)
{
startTime = 0 ;
endTime = 0 ;
}
}
I don't have any errors so far, I am more stuck on how to begin a method that returns the hour, minute, etc.. (the third bullet). Hopefully I have done everything okay so far but if anyone can help me with that one part I would really appreciate it. Thank you!