Search:

Type: Posts; User: Norm

Search: Search took 0.19 seconds.

  1. Replies
    16
    Views
    1,375

    Re: Player input not working

    It would be useful if you made the test program and worked with it to learn how to use indexOf and substring. The posted code does not show what is in the String s or print out the value of space or...
  2. Replies
    16
    Views
    1,375

    Re: Player input not working

    Did you try the test program I suggested?
    That is how I check out new classes and methods - write a small test print and print out the results.
  3. Replies
    16
    Views
    1,375

    Re: Player input not working

    What is in the String: height? What is the value in space?
    Print them out so you can see what their values are.

    I suggest that you write a small test program with these 5 lines:
    Define a String...
  4. Replies
    16
    Views
    1,375

    Re: Player input not working

    "Exception in thread "main" java.lang.NumberFormatException: For input string: "59 1.72"

    That looks like the original problem.

    Did you use substring to get the two numbers from the input...
  5. Replies
    16
    Views
    1,375

    Re: Player input not working

    Does it work now?

    If not, please post any further questions or problems.
  6. Replies
    16
    Views
    1,375

    Re: Player input not working

    Ok. To use substring you need to know what columns to access. Did he say how to determine what columns to use with the substring method?
    There are several useful methods in the String class:...
  7. Replies
    16
    Views
    1,375

    Re: Player input not working

    Another option - have the user only enter one number at a time.
    Otherwise describe how your instructor expects the program to get the user's input.
  8. Replies
    16
    Views
    1,375

    Re: Player input not working

    The String passed to the parseDouble method is not a valid double value. It looks like there are two values there separated by a space.
    To get at the separate values in the String, read the user's...
Results 1 to 8 of 8