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:
[code=java]import java.util.Scann er;
public class AssignmentNo1
{
public static void main(String[] args)
{
int hours, minutes, seconds;
Scanner keyboard = new Scanner(System. in);
System.out.prin tln("Enter number of seconds : ")
seconds = keyboard.nextIn t();
hours = seconds/3600;
minutes = seconds/60;
seconds = seconds%3600
System.out.prin tln("Hours used:" + hours);
System.out.prin tln("Minutes used:" + minutes);
System.out.prin tln("Seconds used:" + seconds);
}
}[/code]
When I compile it, it gives me an error in the "seconds = keyboard.nextIn t();" line saying : " wedge2: exit code for process is 1."
thanks ALOT for any help.
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:
[code=java]import java.util.Scann er;
public class AssignmentNo1
{
public static void main(String[] args)
{
int hours, minutes, seconds;
Scanner keyboard = new Scanner(System. in);
System.out.prin tln("Enter number of seconds : ")
seconds = keyboard.nextIn t();
hours = seconds/3600;
minutes = seconds/60;
seconds = seconds%3600
System.out.prin tln("Hours used:" + hours);
System.out.prin tln("Minutes used:" + minutes);
System.out.prin tln("Seconds used:" + seconds);
}
}[/code]
When I compile it, it gives me an error in the "seconds = keyboard.nextIn t();" line saying : " wedge2: exit code for process is 1."
thanks ALOT for any help.
Comment