package zuoye;
import java.util.Scanner;
public class Zuoye4 {
@SuppressWarnings("resource")
public static void main(String[] args) {
int pwd = 111111;
Scanner sc = new Scanner(System.in);
int i = 4;
while (i > 0) {
if (i == 1) {
System.out.println("密码错误,三次机会用完,请取卡");
break;
} else {
System.out.println("请输入您的密码,密码只能输入" + (i - 1) + "次,否则卡将退回");
int j = sc.nextInt();
if (j == pwd) {
System.out.println("密码输入正确,您的余额为10000元,请输入您要取的金额。注:金额只能100-3000元之间,且为100的倍数");
int money = sc.nextInt();
if (money % 100 == 0 && money < 3000 && money > 100) {
System.out.println("恭喜您取款成功,您的余额还剩" + (10000 - money) + "元");
} else {
System.out.println("您输入的金额不符合规则,请取卡");
}
break;
}
i--;
}
}
}
}
模拟银行取钱系统
最新推荐文章于 2024-11-04 09:11:09 发布