Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: User Input help

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    24
    My Mood
    Dead
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation User Input help

    I wish to know how I can allow a user to input a name, and 2 numbers (such as 0.5 and 1234.0) and the code returns an answer.
    I have the rough idea as:

    get user input
    search
    retrieve and print out results.

    I am new to java and know basics, but this is advanced for me, so explanations for any codes you suggest
    thanks


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: User Input help

    What do you have so far, and what parts do you need help with specifically?

    For getting user input, I would recommend using the Scanner class.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    24
    My Mood
    Dead
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: User Input help

    Quote Originally Posted by helloworld922 View Post
    What do you have so far, and what parts do you need help with specifically?

    For getting user input, I would recommend using the Scanner class.
    I dont have anything at the moment because I dont know where to start. So being quite specific, I need an example of the code that will get user input, A specific word such as apple. The the program will search itself for the term apple, and bring up its specs (20 grams, 8 left). So again, I just need the types of coding I would use, example array, strings etc, and its layout with an explanation.

  4. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: User Input help

    Quote Originally Posted by dx2731 View Post
    I dont have anything at the moment because I dont know where to start.
    Start with a list of steps you will take to solve the problem.

    Quote Originally Posted by dx2731 View Post
    So being quite specific, I need an example of the code that will get user input, A specific word such as apple.
    We don't write code as much as we offer assistance in you writing your own code. A suggestion was already made for the Scanner class, what did you try with that? Code samples are available through most major search engines, and also with the Java documentation, including links to tutorials right from the pages.

    Quote Originally Posted by dx2731 View Post
    The the program will search itself for the term apple,
    Work on this after you get the user input working

    Quote Originally Posted by dx2731 View Post
    and bring up its specs (20 grams, 8 left).
    Work on this after you are able to search and find a term

    Quote Originally Posted by dx2731 View Post
    So again, I just need the types of coding I would use, example array, strings etc, and its layout with an explanation.
    Post the full text of any error messages you may have with the code when you post your question. Then we can all see what is going on and get you the best help possible.

Similar Threads

  1. User Input help
    By lanmonster in forum What's Wrong With My Code?
    Replies: 20
    Last Post: January 20th, 2013, 10:44 AM
  2. Take user input
    By frabbi.cse in forum Java Theory & Questions
    Replies: 1
    Last Post: July 22nd, 2012, 12:48 PM
  3. User Input with a Do Loop
    By RadiantChaos in forum Loops & Control Statements
    Replies: 4
    Last Post: March 13th, 2012, 07:14 PM
  4. User Input File Name
    By PineAppleKing in forum Java Theory & Questions
    Replies: 12
    Last Post: June 3rd, 2011, 10:23 AM
  5. User Input Loop
    By cfmonster in forum Loops & Control Statements
    Replies: 7
    Last Post: August 24th, 2009, 01:52 PM