java 代码模拟银行操作

闲着没事玩。
简单操作,简单操作,简单操作!

public static void main(String[] args) {
        System.out.println("输入密码");
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        if (line.equals("123456")){
            System.out.println("1.取");
            System.out.println("2.存");
            int num = scanner.nextInt();
            switch (num){
                case 1:
                    System.out.println("1.取100");
                    System.out.println("2.取200");
                    System.out.println("3.取500");
                    System.out.println("4.自定义");
                    int info = scanner.nextInt();
                    switch (info){
                        case 1:
                            System.out.println("取出100");
                            break;
                        case 2:
                            System.out.println("取出200");
                            break;
                        case 3:
                            System.out.println("取出500");
                            break;
                        case 4:
                            System.out.println("请输入要取出金额");
                            int money = scanner.nextInt();
                            System.out.println("取出"+money+"元");
                            break;
                    }
                case 2:
                    System.out.println("存多少?");
                    int money = scanner.nextInt();
                    System.out.println("把钱放入下方窗口");
                    System.out.println("存储"+money+"元");
                    break;
                default:
                    System.out.println("谢谢使用,欢迎下次再来");
            }
        }
    }

你可能感兴趣的:(代码)