获取输入的提示字符时无法退出程序或循环,卡在这里半天,不知道怎么弄
/*
1. 通过键盘输入用户的月薪,每年是几个月的薪水
2. 输出用户的年薪
3. 输出“如果年薪超过十万,恭喜你超越90%的国人水平”,“如果年薪超过20万,恭喜你超过98%的国人水平”
4. 根据提示输入“exit”,则退出程序(使用break退出循环)
5.根据提示输入“next”时,则退出计算,进行下一轮计算
*/
package Break;
import java.util.Scanner;
public class WorkMoney {
public static void main(String[] args) {
Scanner Month = new Scanner(System.in);
System.out.println("请输入您的月薪:");
int Mon = Month.nextInt();
Scanner year = new Scanner(System.in);
System.out.println("请输入每年是几个月的薪水:");
int Months = year.nextInt();
out:while (Mon>=0||Months>=0){
System.out.println(Mon*Months);
if (Mon * Months > 100000 && Mon * Months<=200000){
System.out.println("恭喜你超越90%的国人水平");
} else if (Mon * Months > 200000) {
System.out.println("恭喜你超过98%的国人水平");
}else {
System.out.println("恭喜你收入为一般的国人水平");
}
Scanner sc = new Scanner(System.in);
System.out.println("如要退出,请输入exit;如要继续,请输入next");
String Exit = sc.nextLine();
}
}
}