Hey guys,
I am taking Programming I this semester and I am completely new to Java. for my FIRST assignment i need to write a Java program that will give me hours, minutes and seconds after I type in a number
for example it should look like this:
Enter numbers of seconds: (Where i type the number)
Hours used: (how many hours in that number)
Minutes used: (how many minutes in that number)
Seconds used: (how many seconds in that number)
so far my code looks like:
- import java.util.Scanner;
-
-
public class AssignmentNo1
-
{
-
public static void main(String[] args)
-
{
-
int hours, minutes, seconds;
-
-
Scanner keyboard = new Scanner(System.in);
-
System.out.println("Enter number of seconds : ")
-
seconds = keyboard.nextInt();
-
-
hours = seconds/3600;
-
minutes = seconds/60;
-
seconds = seconds%3600
-
-
System.out.println("Hours used:" + hours);
-
System.out.println("Minutes used:" + minutes);
-
System.out.println("Seconds used:" + seconds);
-
}
-
}
When I compile it, it gives me an error in the "seconds = keyboard.nextInt();" line saying : " wedge2: exit code for process is 1."
thanks ALOT for any help.