import java.util.Scanner;
public class demo2 {
public static void main(String[] args) {
String zh = “123456”;
String ma = “456789”;
System.out.println(“请输入账号:”);
Scanner input = new Scanner(System.in);
String name = scanner.next;
System.out.println(“请输入密码:”);
String pwd = input.next();
if (!username.equals(name)) {
System.out.println(“输入错误!”);
System.out.println(“请重新输入”);
name = scanner.next();
}
if (username.equals(name)) {
System.out.println(“请输入密码”);
int count = 2;
for (int i = 0; i < 3; i++) {
String pwd = scanner.next();
if (!pwd.equals(password)) {
System.out.println(“输入错误,请重新输入,还有两次机会”);
if (i == 2) {
System.exit(-1);
} else {
System.out.println(“登陆成功”);
break;
}
}
Scanner input = new Scanner(System.in);
System.out.println("*****欢迎使用中国银行自助ATM存取款机*****");
System.out.println("1.取款\t2.存款\t3。查询余额\t4.退出系统");
System.out.println("请选择:");
String num = input.next();
double money = 5000.00;
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("存款成功,存款金额为:" + ckje);
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.退出系统");
System.out.println("*******************************************");
System.out.println("请选择:");
num = input.next();
}
while (true);
}
}
}
}