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 =...
Type: Posts; User: northernlightifly
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 =...
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);
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"
no it doesn't work >.<
here's the error: "Exception in thread "main" java.lang.NumberFormatException: For input string: "59 1.72"
at...
something about fetching the words height and weight for a substring?
for example:
int space = weight.indexOf(' ');
int bar = height.indexOf(' ');
He said to use substring.
Thank you for replying! If you mean by slipt it into an array I'm not allowed to do that or use regex.
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");
...