472,958 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

need help with input and scanner keyboard..NEW TO JAVA

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:

Expand|Select|Wrap|Line Numbers
  1. import java.util.Scanner;
  3. public class AssignmentNo1
  4. {
  5. public static void main(String[] args)
  6. {
  7. int hours, minutes, seconds;
  9. Scanner keyboard = new Scanner(System.in);
  10. System.out.println("Enter number of seconds : ")
  11. seconds = keyboard.nextInt();
  13. hours = seconds/3600;
  14. minutes = seconds/60;
  15. seconds = seconds%3600
  17. System.out.println("Hours used:" + hours);
  18. System.out.println("Minutes used:" + minutes);
  19. System.out.println("Seconds used:" + seconds);
  20. }
  21. }
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.
Sep 20 '08 #1
2 4736
11,448 Expert 8TB
I don't know what 'wedge2' is but I find it a very clumsy way of telling you that
you've forgotten a semicolon at the end of the previous line. Drop that thing and
simply use javac or a decent IDE.

kind regards,

Sep 20 '08 #2
3,112 Expert 2GB
I don't know what 'wedge2' is but I find it a very clumsy way of telling you that
you've forgotten a semicolon at the end of the previous line.
By the
way, that's not the only semicolon you've forgotten. Look through your code again.

Oh, I've also replaced your [i] tags with [code] tags - they're thought for posting code and you should use them.

Nepomuk (Moderator)
Sep 21 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: 848lu | last post by:
hey i really need help...i got this code....basically im suppose to make a calender that allows a user to type in month and year .... and the calander displays it on the scree using...
by: ray2007colon | last post by:
I need to now how to compare the elements of two arrays. Here is my program. Now I need to compare each element. So I can print the arrays and the elements that are not the same. import...
by: dalearyous | last post by:
ok basically i need to write a program that will replace normal words in a sentence with pirate words. the trick is it needs to be able to take two word phrases. i went about this two different ways:...
by: biznitchil | last post by:
it is a bit jacked up, but copy and paste it into an IDE(i use jGRASP) plz help me...it worked just fine before I added the menu..you can e-mail me if you have any <Removed> import java.util.*; ...
by: saytri | last post by:
Hi i have this project were i have to do a quiz. i wrote the questions in a textfile and i called them through java. I have also made a menu to choose which type of quiz. But before accessing the...
by: 100grand | last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price...
by: BlueroY | last post by:
hi, I'm working on an exercise, i did a lot of work already and i just can't figure where I'm going wrong, this is what I'm trying to achieve Sample IO...
by: cdm2883 | last post by:
here is my code, i am having trouble with getting my brakets in the right place so i can run my program. package mooredMod2; import java.util.Scanner; import java.util.Random; import...
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got an application that takes input from a handheld scanner: Once the incoming text meets the RegEx format and is the correct length, the command is accepted. The scanner that plugs in on...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.