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");
0 · ·