Search:

Type: Posts; User: northernlightifly

Search: Search took 0.11 seconds.

  1. Replies
    16
    Views
    1,375

    Re: Player input not working

    No but it helped me figure it out so it can write out height and weight in the terminal but now I have to make a string with both weight and height

    int space = s.indexOf(' ');
    int bar =...
  2. Replies
    16
    Views
    1,375

    Re: Player input not working

    My mad I forgot to add numbers based on their position like this
    String first = height.substring(0, 5);

    String third = weight.substring(0, 4);
  3. Replies
    16
    Views
    1,375

    Re: Player input not working

    something like this?

    String first = height.substring(0, space);

    I get this error "Exception in thread "main" java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 5"
  4. Replies
    16
    Views
    1,375

    Re: Player input not working

    no it doesn't work >.<

    here's the error: "Exception in thread "main" java.lang.NumberFormatException: For input string: "59 1.72"
    at...
  5. Replies
    16
    Views
    1,375

    Re: Player input not working

    something about fetching the words height and weight for a substring?
    for example:
    int space = weight.indexOf(' ');
    int bar = height.indexOf(' ');
  6. Replies
    16
    Views
    1,375

    Re: Player input not working

    He said to use substring.
  7. Replies
    16
    Views
    1,375

    Re: Player input not working

    Thank you for replying! If you mean by slipt it into an array I'm not allowed to do that or use regex.
  8. Replies
    16
    Views
    1,375

    Player input not working

    Hello!

    I'm making a BMI calculator but it's not working when I try to type in my height and weight.

    this is the error I get


    String s = JOptionPane.showInputDialog("height and weight");
    ...
Results 1 to 8 of 8