Ok, I'll start with the toString method since that's where it appears you left off.
Code:
public String toString()
{
String output;
if (hours > 12)
output = hours%12 + ":" + minutes + ":" + seconds +" PM";
else output = hours%12 + ":" + minutes + ":" + seconds + " AM";
return output;
}
And for the subtract method...
Code:
public static Duration Subtract(Time t1, Time t2)
{
int hr_dif, min_dif, sec_dif;
if t1.getHours() < t2.getHours)
//throw exception I'll leave this up to you.
else
{
hr_dif = t1.getHours() - t2.getHours();
min_dif = t1.getMinutes - t2.getMinutes();
sec_dif = t1.getSeconds() - t2.getSeconds();
}
//create new Duration object with the difference in time
Duration time_dif = new Duration(hr_dif, min_dif, sec_dif);
return time_dif;
}
Give that a shot, there may be some syntax errors (I did it rather quickly), let me know how it turns out for you.
EDIT: The subtract method is incorrect for a number of reasons (negative seconds) and (what if seconds/minutes > 60). I'll leave this part up to you. ;-) 2nd EDIT: I'm retarded... the Duration class already handles minutes/seconds > 60... so really you have two options. Either use the absolute value function or double negate them. Ex. (if min < 0) min = -min.