I am trying to run a while loop that ends with a Y/N option to do it again. This is a calculator, I keep getting this error message error: cannot find symbol symbol: variable scan location: class Calculator Im trying to scan the next line for the letter y so the code knows to loop it or not but it seems to not be working, can someone help?
'''
import java.util.Scanner;
import static java.lang.System.*;
public class Calculator{
public static void main(String[]args) {
//variables
double num1;
double num2;
int y = 1;
double result=0;
int whichCalculation;
int start = 0;
Scanner input = new Scanner(System.in);
while (start == y)
//instructions
System.out.println("Choose a way to calculate. 1 to add 2 to subtract 3 to multiply 4 to divide.");
//take the users task
whichCalculation = input.nextInt();
//get the numbers
System.out.println("please enter the first number.");
num1 = input.nextDouble();
System.out.println("please enter the second number.");
num2 = input.nextDouble();
//calculation
if (whichCalculation == 1) {
result = num1 + num2;
}
if (whichCalculation == 2) {
result = num1 - num2;
}
if (whichCalculation == 3) {
result = num1 * num2;
}
if (whichCalculation == 4) {
result = num1 / num2;
}
//answer
System.out.println("the answer is,,,");
System.out.println(result);
System.out.println("do you want to continue y/n?");
start =scan.nextLine();
}
}