| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 814 人关注过本帖
标题:我做的ATM机系统
只看楼主 加入收藏
卢静
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-4-27
结帖率:0
收藏
 问题点数:0 回复次数:2 
我做的ATM机系统
package bank.ABC.atm;

import java.util.Scanner;

public class T1 {
    private int password, password1, password2;
    private int money, money1, money2, money3, i, j;

    // i代表后续你选择服务编码的数字键
    // j代表是否继续交易的数字键
    public T1() {
        System.out.println("欢迎进入中国农业银行ATM服务!");
    }

    public int Sever() {
        Scanner t1 = new Scanner(System.in);
        System.out.print("请选择您所需要的服务,按对应数字键进行交易:");
        int i = t1.nextInt();
        return i;
    }

    public String setPassword() {
        System.out.print("请输入6位数字的密码:");
        Scanner s = new Scanner(System.in);
        String password = s.nextLine();
        int b = password.length();
        if (b != 6)
            System.out.println("输入错误,请重新输入!");
        // System.out.println(password);
        return password;
    }

    public void mainPage() {
        for (int m = 1; m <= 8; m++) {
            if (m == 1 || m == 8) {
                for (int n = 1; n <= 30; n++)
                    System.out.print("*");
            } else
                for (int z = 1; z <= 36; z++) {
                    if (z <= 3 || z >= 34)
                        System.out.print("*");
                    else if (z == 12) {
                        if (m == 2)
                            System.out.print("1 取款       ");
                        if (m == 3)
                            System.out.print("2 存款       ");
                        if (m == 4)
                            System.out.print("3 转账       ");
                        if (m == 5)
                            System.out.print("4 查询余额");
                        if (m == 6)
                            System.out.print("5 修改密码");
                        if (m == 7)
                            System.out.print("6 取卡        ");
                    } else
                        System.out.print(" ");
                }
            System.out.println();
        }
    }

    public int quKuan() {
        Scanner s = new Scanner(System.in);
        System.out.print("请输入取款金额:");
        int num = s.nextInt();
        money1 = num;
        if (money == 0 && money2 > money1 || money >= 100) {
            if (num % 100 == 0) {

                System.out.println("您的取款金额为:" + money1);
            } else {
                System.out.println("输入错误,请重新输入!");
            }
        } else
            System.out.println("您当前余额不足!");
        return money1;
    }

    public int cunKuan() {
        Scanner s = new Scanner(System.in);
        System.out.print("请输入存款金额:");
        int num = s.nextInt();
        if (num % 100 == 0) {
            money2 = num;
            System.out.println("您的存款金额为:" + money2);
        } else {
            System.out.println("输入错误,请重新输入!");
        }
        return money2;
    }

    public int zhuanZhang() {
        Scanner t = new Scanner(System.in);
        System.out.print("请输入转账卡号:");
        String cardCode = t.nextLine();
        System.out.print("请输入转账金额:");
        int num = t.nextInt();
        money3 = num;
        if (money >= money3)
            System.out.println("请确认输入转账金额:" + money3 + "按确认键结束");
        else
            System.out.println("您当前余额不足!不能进行转账操作。");
        return money3;
    }

    public int yuE() {
        money = money2 - money1 - money3;
        if (money >= 0)
            System.out.println("您当前余额为" + money);
        return money;
    }

    public int setNewPassword() {
        // this.password = num;
        System.out.println("请输入旧密码:" + password);
        Scanner s = new Scanner(System.in);
        System.out.print("请输入新密码:");
        password1 = s.nextInt();
        Scanner t = new Scanner(System.in);
        System.out.print("请再次输入新密码:");
        password2 = t.nextInt();
        if (password1 == password2)
            password = password1;
        else
            System.out.println("您两次输入的密码不一样,请根据提示正确输入");
        return password;
    }

    public void exitCard() {
        System.out.println("谢谢合作,欢迎您下次光临!");
    }

    public void setJudge() {
        Scanner s1 = new Scanner(System.in);
        System.out.print("是否继续交易:(1代表继续交易,0代表结束交易)");
        j = s1.nextInt();
    }

    public int getJudge() {
        j = j;
        return j;
    }

    public static void main(String[] args) {
        T1 p = new T1();
        do {
            p.setPassword();

            p.mainPage();
            Scanner t1 = new Scanner(System.in);
            System.out.print("请选择您所需要的服务,按对应数字键进行交易:");
            int i = t1.nextInt();
            switch (i) {
            case 1:
                p.quKuan();
                break;

            case 2:
                p.cunKuan();
                break;
            case 3:
                p.zhuanZhang();
                break;
            case 4:
                p.yuE();
                break;
            case 5:
                p.setNewPassword();
                break;
            case 6:
                p.exitCard();
                break;
            }
            p.setJudge();
            p.getJudge();
            // System.out.println(p.j);
        } while (p.j == 1);
        p.exitCard();
    }
}
搜索更多相关主题的帖子: password 中国农业 private package public 
2015-04-27 15:00
wj13370336
Rank: 2
等 级:论坛游民
帖 子:16
专家分:12
注 册:2012-11-12
收藏
得分:0 
你想说明啥?
2015-04-27 15:49
李哈哈
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-5-3
收藏
得分:0 
不行啊,运行不了啊。。表示jdk7运行不了

[ 本帖最后由 李哈哈 于 2015-5-3 21:59 编辑 ]
2015-05-03 21:58
快速回复:我做的ATM机系统
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.052254 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved