import java.util.Scanner; public class zixi { public static void main(String[] args) { String zh = "dashuaige"; String mima = "zhenniu"; Scanner it = new Scanner(System.in); int cf = 0; while (cf < 3) { System.out.println("请输入你的账号"); String j = it.next(); System.out.println("请输入你的密码"); String k = it.next(); cf++; if (zh.equals(j) && mima.equals(k)) { System.out.println("******欢迎使用DD]银行ATM自助存取款机"); System.out.println("1.取款/t2.存款/t3.查询余额/t4.结束"); System.out.println("******************************"); Scanner in = new Scanner(System.in); int ye = 10000; System.out.println("请输入您的选择"); int i = in.nextInt(); do { switch (i) { case 1: System.out.println("请输入您的取款金额"); int a = in.nextInt(); if (a > ye) { System.out.println("余额不足"); } else if (a <= ye) { ye = ye - a; } break; case 2: System.out.println("请输入你要存款的金额"); int b = in.nextInt(); ye = ye + b; System.out.println("存款成功"); break; case 3: System.out.println("您的余额为" + ye); break; case 4: System.out.println("欢迎下次光临"); System.exit(-1); break; } System.out.println("******欢迎使用cf银行ATM自助存取款机"); System.out.println("1.取款/t2.存款/t3.查询余额/t4.结束"); System.out.println("******************************"); System.out.println("请输入你的选择"); } while (true); }else { System.out.println("登录失败,请重新输入"); } if (cf==3){ System.out.println("系统出错,即将退出"); System.exit(-1); } } }
02-28