Hi,
I am not sure what is wrong with the following code, and was hoping that someone would shed some light on why I am getting the following errors when I try to compile.
newGame.java:55: cannot resolve symbol
symbol : variable number
location: class newGame
else if (
test > number)
^
newGame.java:63: cannot resolve symbol
symbol : variable number
location: class newGame
else if (test < number)
^
2 errors
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
PLEASE HELP!! (here is the code)
import javax.swing.*;
import java.text.*;
import java.util.Random;
public class newGame
{
public static void main(
String[] args)
{
Random generator = new Random();
int number = generator.nextInt(1000);
String userInput = JOptionPane.showInputDialog("Give me a number between 0 and 1000");
int stringLength = userInput.length();
int guess = Integer.parseInt(userInput);
int checkedGuess = errorCheck(guess);
}
public static int errorCheck(int test)
{
if (test > 1000)
{
return 0;
}
else if (test > number)
{
return 1;
}
else if (test < number)
{
return 2;
}
else
return 3;
}
}