我已经用Java制作了一个计算器,它工作正常,但是存在一个问题,我正在使用do while循环询问用户是否要再次运行代码,但是每当我输入Y / y时,它就永远不会再次运行程序它只是结束程序请帮助我
double Fnum;
double Snum;
String Choose;
do {
System.out.println("Press 1 for sum\n" + "press 2 for subtraction\n"
+ "press 3 for multiplication\n" + "press 4 for division\n"
+ "and 5 to see table");
Scanner input = new Scanner(System.in);
int n = input.nextInt();
if(n==1) {
System.out.println("Please enter first num");
Scanner Cal= new Scanner(System.in);
Fnum = Cal.nextInt();
System.out.println("Please enter Second num");
Snum = Cal.nextInt();
double Sum = Fnum + Snum;
System.out.println(Sum);
}
else if(n==2) {
System.out.println("Please enter first num");
Scanner Cal= new Scanner(System.in);
Fnum = Cal.nextInt();
System.out.println("Please enter Second num");
Snum = Cal.nextInt();
double Sub = Fnum - Snum;
System.out.println(Sub);
}
else if(n==3) {
System.out.println("Please enter first num");
Scanner Cal= new Scanner(System.in);
Fnum = Cal.nextInt();
System.out.println("Please enter Second num");
Snum = Cal.nextInt();
double Mul = Fnum * Snum;
System.out.println(Mul);
}
System.out.println("Continue(Y/N)");
Scanner ans = new Scanner(System.in);
Choose = ans.next();
}while(Choose =="Y" || Choose =="y") ;
} }