Java time class
<p>Ok this is homework and i am struggling a bit, i cant figure out what to pass in toString method and i am not quite sure my methods for getting the current and the elapsed time are correct. I then have to pass this to the main method and display the times in output statements. That is not really my problem, i can only have 3 variables, how can i figure out the elapsed time from the current time and still hold the original hour, second, minute variables without changing them so all data from both time constructors are held in those variables? I hope i am making sense.Thanks for any input</p>

<pre><code>package chapter_10;


public class Time {
    private long hour;
    private long minute;
    private long second;

    public void time() {
        long second = System.currentTimeMillis();
        long minute = System.currentTimeMillis();
        long hour = System.currentTimeMillis();
    }
    public void setTime(long elapsedTime){
       long millisecond = System.currentTimeMillis();
       long second = millisecond / 1000;
       long minute = second / 60;
       long hour = minute /60;
    }
     public long getHour() {
        return hour;
    }

    public long getMinute() {
        return minute;
    }

    public long getSecond() {
        return second;
    }

   public String toString(){
       return    // what should i return here, String.towhat?
   }
}
</code></pre>

<p>Here is the assignment, just to clarify.
Time class:</p>

<p>give it 3 private data members for hour, minute, and second. Use type long or int.
If you use int you must cast inside the ctors.
add a no-arg ctor that uses code like that in Listing 2.6 on p38 to assign values
to hour, minute, and second from the current time.
add another ctor that will take a single long parameter named elapseTime (better
would be elapsedTime), a number for milliseconds since the Unix epoch date.
this second ctor will also use code as per Listing 2.6 to set the data members
for that elapsed time since the epoch.
a third ctor is not necessary.
add a getter for each data member. Each getter will require only a single statement.
Getters are needed because the data members are private.
add a toString method that returns the hours, minutes, and seconds for a Time object.
main class:</p>

<p>in the main method create a Time object with the no-arg ctor.
create a few time objects with the other ctor.
display the times for each object you instantiate.</p>
