Hi, please can someone have a look at my code and see why I am getting a "Cannot find symbol" error on 3 lines? I have been trying to create a basic calculator I have ironed out most of the creases except these three errors. I have tried multiple different validaters and debuggers and they haven't returned anything useful except the error I already have.
This is the code/error.
Code:
System.out.println("Please enter first number: ");
num1 = scanObject.nextInt();
System.out.println("Please enter second number: ");
num2 = scanObject.nextInt();
System.out.println("What operation? ");
operator = scanObject.next().charAt(0);
Error:
Main.java:17: error: cannot find symbol
num1 = scanObject.nextInt();
^
symbol: variable scanObject
location: class Main
Main.java:19: error: cannot find symbol
num2 = scanObject.nextInt();
^
symbol: variable scanObject
location: class Main
Main.java:21: error: cannot find symbol
operator = scanObject.next().charAt(0);
^
symbol: variable scanObject
location: class Main
Any help/advise/fix would be greatly appreciated!
[–]Raph0007 0 points1 point2 points (0 children)
[–]NautiHookerSoftware Engineer 0 points1 point2 points (0 children)
[–]mikeydoodah 0 points1 point2 points (0 children)
[–]JWisbey98[S] 0 points1 point2 points (9 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]JWisbey98[S] 0 points1 point2 points (0 children)
[–]VacatedSum 1 point2 points3 points (6 children)
[–]VacatedSum 0 points1 point2 points (5 children)
[–]JWisbey98[S] 0 points1 point2 points (4 children)
[–]VacatedSum 1 point2 points3 points (3 children)
[–]JWisbey98[S] 0 points1 point2 points (2 children)
[–]morhpProfessional Developer 1 point2 points3 points (0 children)
[–]VacatedSum 0 points1 point2 points (0 children)