import java.util.Scanner;
public class zhmm {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("*****欢迎使用中国银行自助ATM存取款机*****");
for (int i = 0; i < 3; i++) {
System.out.println("请输入您的账号:");
int zh = input.nextInt();
System.out.println("请输入您的密码:");
int mm = input.nextInt();
if (zh == 123456 && mm == 666666) {
System.out.println("登陆成功!");
break;
} else if (2 - i == 0) {
System.out.println("您的账号密码错误太多!以强制退出!");
System.exit(-1);
break;
} else {
System.out.println("您的账号密码剩余" + (2 - i) + "次机会");
}
}
System.out.println("1.取款\t2.存款\t3.查询金额\t4.退出系统\t");
System.out.println("***************************************");
System.out.println("请选择");
String num = input.next();
double money = 5000;
do {
switch (num) {
case "1":
System.out.println("请输入取款金额");
double qkje = input.nextDouble();
if (qkje <= money) {
money = money - qkje;
System.out.println("取款金额为" + qkje);
} else {
System.out.println("余额不足");
}
break;
case "2":
System.out.println("请输入存款金额");
double ckje = input.nextDouble();
money = money + ckje;
System.out.println("存款成功!");
break;
case "3":
System.out.println("您的余额为" + money);
break;
case "4":
System.out.println("谢谢使用,欢迎下次光临!");
System.exit(-1);
break;
}
System.out.println("*****欢迎使用中国银行自助ATM存取款机*****");
System.out.println("1.取款\t2.存款\t3.查询金额\t4.退出系统\t");
System.out.println("****************************************");
System.out.println("请选择");
num = input.next();
} while (true);
}
}
01-19
1万+
12-07