package xin;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import javax.swing.JOptionPane;

public class Islonger {

    /**
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        String inputpassword = JOptionPane.showInputDialog("请输入密码:");
        String usepassword = "1230";
        int cuwu = 0;

        while (cuwu < 3) {
            if (inputpassword.equals(usepassword)) {
                String mm = JOptionPane
                        .showInputDialog("1-存款,2-取款,3-转帐,4-查询余额,9-退出系统");
                String hm1 = "1";
                String hm2 = "2";
                String hm3 = "3";
                String hm4 = "4";
                String hm5 = "9";
                // String w=JOptionPane.showInputDialog("请输入存款金额:");

                if (mm.equals(hm1)) {
                    String w = JOptionPane.showInputDialog("请输入存款金额:");
                    JOptionPane.showMessageDialog(null, "你好此次存款:" + w, "1-存款",
                            JOptionPane.PLAIN_MESSAGE);

                } else if (mm.equals(hm2)) {
                    String Q = JOptionPane.showInputDialog("请输入金额:");
                    JOptionPane.showMessageDialog(null, "你好此次取款:" + Q, "2-取款",
                            JOptionPane.PLAIN_MESSAGE);
                } else if (mm.equals(hm3)) {
                    String e = JOptionPane.showInputDialog("请输入转帐金额:");
                    JOptionPane.showMessageDialog(null, "转帐成功" + e, "转帐",
                            JOptionPane.PLAIN_MESSAGE);
                } else if (mm.equals(hm4)) {

                    JOptionPane.showMessageDialog(null, "目前余额为:", "查询余额",
                            JOptionPane.PLAIN_MESSAGE);
                } else if (mm.equals(hm5)) {
                    JOptionPane.showMessageDialog(null, "退出系统 !", "结束",
                            JOptionPane.PLAIN_MESSAGE);
                    System.exit(0);
                } else {
                    JOptionPane.showMessageDialog(null, "操作错误:", "错误指令",
                            JOptionPane.PLAIN_MESSAGE);
                }

            } else {
                cuwu++;
                if (cuwu <= 2) {
                    inputpassword = JOptionPane.showInputDialog(null,
                            "对不起,密码错误!", "错误", JOptionPane.ERROR_MESSAGE);
                } else {
                    JOptionPane.showMessageDialog(null, "密码错误三次,死锁!", "锁定!",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        }
        System.exit(0);
    }

}