(http://i41.tinypic.com/x4299f.png)
It compiles, and the first dialog box pops up.
(http://i44.tinypic.com/317fm9c.png)
I enter "Air" into it (minus the "), and it gives me this error.
(http://i41.tinypic.com/2qlvmur.png)
Dats some ugly code you got their Nate :)
Quote from: James on September 12, 2013, 08:43:16 AM
Dats some ugly code you got their Nate :)
sorry, im currently in my 3rd week of ever using java in my life haha
Ummm you don't have anything defined as "value"... You make a case for something being "air" if you haven't defined it.
Quote from: Kryptonite on September 12, 2013, 04:14:13 PM
Ummm you don't have anything defined as "value"... You make a case for something being "air" if you haven't defined it.
I dont really know how to define it :p. Could you just show me what I need to add to it?
Quote from: nate on September 12, 2013, 08:00:51 PM
Quote from: Kryptonite on September 12, 2013, 04:14:13 PM
Ummm you don't have anything defined as "value"... You make a case for something being "air" if you haven't defined it.
I dont really know how to define it :p. Could you just show me what I need to add to it?
Um okay, so you have "double air = 1100;" that's defining a double named "air" and setting the value as 1100. You need to do something similar for "value", so wherever that "value" is supposed to be coming from (I don't know where you want this), do something like you did with the air and stuff except name it value.
I updated the first post
Quote from: nate on September 13, 2013, 08:01:35 PM
I updated the first post
You spelled integer wrong.
8)
shhhhhhhh! ;)
ok so now that I changed that, I get this error. havent changed anything else but interger to integer.
Still a little confused because I have initialized distance and time as a int. I tried also doing
String time;
String distance;
but that don't work :p
(http://i41.tinypic.com/8x1xqc.png)
Can you update your first post again?
updated
Quote from: James on September 12, 2013, 08:43:16 AM
Dats some ugly code you got their Nate :)
James! you code so he gets A++++ ON TEST!
Ok nate, for the error you posted in your first post, you're trying to convert the string "Air" into an integer, but "air" is all letters.
I wrote one possible solution for you. After the end of your void "main", (right before the last bracket), add this int (i hope you know how to do this for gods sake):
private static int GetNumericalType(String input) {
if (input.equalsIgnoreCase("Air"))
return Air;
if (input.equalsIgnoreCase("Water"))
return Water;
if (input.equalsIgnoreCase("Steel"))
return Steel;
}
This transforms your string input into the numbers that you defined. Now, switch this in your class (line 20 in your picture, where you're having troubles):
type = Integer.parseInt(input);
replace that with this:
type = GetNumericalType(input);
Then you should be good to go. I may have made a slight mistake because I wrote this stuff down in a crappy editing program. If you get any errors after this let me know.
Also, if you're still getting "Variable distance might not have been initialized" error, instead of defining distance as
int distance;
write it as
int distance = 69; //yolo
I think I covered everything......
THANKS SO MUCH IT FINALLY WORKED ;D ;D
Yay :D