Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Converting Seconds into Minutes, Hours and Seconds... HELP!(PartII)
Well this is for the second part of the assignment.. Fock.
I dont know why I can't seem to figure this out.
But I think once I get these two down.. I should have a pretty good understanding.
Now my program is prompting me to INITIALIZE my variables.. and I dont understand why.
Here's what I got. What I'm suposed to be able to do with this one, is type in a value..
And then Convert it into
If you could help me out with why this isnt working, that would be awesome.
public static void main (String args) // Main input.
int minutes, hours, seconds, timeInSeconds = 0; //declaration of variables.
timeInSeconds = timeInSeconds - (hours * 3600);
Scanner scan = new Scanner (System.in); // declaration of scanner class.
System.out.print ("Enter the number of seconds: ");
timeInSeconds = scan.nextInt();
hours = timeInSeconds / 3600;
timeInSeconds += minutes * 60;
timeInSeconds += seconds;
System.out.println(hours + " hours: ");
System.out.println( + minutes + " minutes: ");
System.out.println( + seconds + " seconds");