Hi, I just started working with Java for a class and Im a little confused. My code is supposed to convert seconds to hours, minutes and the remainder of seconds. for whatever reason my answer is 8 seconds off of what it should be. The example I was given is 20000 seconds has an output of 5 hours, 33 minutes and 20 seconds. My answer is coming out as 5 hours, 33 minutes and 20 seconds. I can't find my mistake--the hours and minutes work fine. maybe someone else can find my error? My code is as follows. Thanks!
//****************************************************
// Lab:ConvertFromSeconds.java Author: Lindsey S
//****************************************************
import java.util.Scanner;
public class ConvertFromSeconds
{
//-------------------------------------------------------------------
//converts Number of seconds to Number of hours, minutes and seconds
//-------------------------------------------------------------------
public static void main (String[] args)
{
Scanner scan = new Scanner (System.in);
System.out.print ("Time in Seconds: ");
int seconds;
seconds = scan.nextInt();
int hours = seconds/3600;
int restHour = seconds%3600;
int minutes = restHour/60;
int sec = restHour%60;
int RemainderOfSeconds = seconds % (hours+minutes) ;
System.out.print(+hours + " hours, ");
System.out.print( + minutes + " minutes and ");
System.out.print( + RemainderOfSeconds + " seconds");
}
}