• 大小: 111KB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-01-28
  • 语言: Java
  • 标签: ATM柜员机  

资源简介

Java——ATM模拟系统,期末Java课程设计 设计要求: 使用图形用户界面。当输入给定的卡号和密码(初始卡号和密码为123456)时,系统能登录ATM柜员机系统,用户可以按照以下规则进行: 1)查询余额:初始余额为10000元 2)ATM取款:每次取款金额为100的倍数,总额不超过5000元,支取金额不允许透支。 3)ATM存款:不能出现负存款。 4)修改密码:新密码长度不小于6位,不允许出现6位完全相同的情况,只有旧密码正确,新密码符合要求,且两次输入相同的情况下才可以成功修改密码。 5)使用数据库保存数据

资源截图

代码片段和文件信息

/*
 * To change this license header choose License Headers in Project Properties.
 * To change this template file choose Tools | Templates
 * and open the template in the editor.
 */
package team.fzn.atm.action;

import team.fzn.atm.dao.AtmDao;
import team.fzn.atm.vo.Users;

/**
 *
 * @author 23944
 */
public class AtmAction {
    //用户
    private static Users user;
    
    private AtmDao atmDao = new AtmDao();
    
    /**
     * 用户登录
     * @param number
     * @param pwd
     * @return 
     */
    public Boolean login(String number String pwd){
        try{
            if(atmDao.findUser(number pwd).getId()!= null){
                user = atmDao.findUser(number pwd);
                return true;
            }else{
                return false;
            }
        }catch(Exception e){
            e.printStackTrace();
            return false;
        }
    }
    
    /**
     * 修改密码
     * @param pwd
     * @param nPwd
     * @param nPwd2
     * @return 0:修改成功 1:原密码错误 2:两次密码不一致 3:密码过于简单
     */
    public Integer modifyPwd(String pwd String nPwd String nPwd2){
        try{
            //判断原密码
            if(user.getPasswd().equals(pwd)){
                //判断两次密码是否一致
                if(nPwd.equals(nPwd2)){
                    //判断密码字符是否全部一致
                    char a = nPwd.toCharArray()[0];
                    Boolean flag = false;
                    for(char c :nPwd.toCharArray()){
                        if(c != a){
                            flag = true;
                            break;
                        }
                    }
                    
                    if(flag){
                        user.setPasswd(nPwd);
                        atmDao.updatePasswd(user);
                        return 0;
                    }else{
                        return 3;
                    }
                    
                }else{
                    return 2;
                }
            }else{
                return 1;
            }
        }catch(Exception e){
            e.printStackTrace();
            return 1;
        }
    }
    
    /**
     * 修改金额
     * @param money
     * @return 
     */
    public Boolean modifyMoney(Double money){
        try{
            if(user.getBalance() >= money){
                user.setBalance(user.getBalance() - money);
                atmDao.updateBalance(user);
                return true;
            }else{
                return false;
            }
        }catch(Exception e){
            e.printStackTrace();
            return false;
        }
    }
    /**
     * 查看账户余额
     * @return 
     */
    public String queryMoney(){
        return String.valueOf(user.getBalance());
    }
    
    /**
     * 存款
     * @param money
     * @return 
     */
    public Boolean saveMoney(Double money){
        try{
            user.setBalance(user.getBalance() + money);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件          0  2020-04-07 18:10  JavaApplication1\build\classes\.netbeans_automatic_build

     文件          0  2020-04-07 18:10  JavaApplication1\build\classes\.netbeans_update_resources

     文件        905  2020-05-07 14:00  JavaApplication1\build\classes\meta-INF\persistence.xml

     文件       3286  2020-05-08 11:12  JavaApplication1\build\classes\team\fzn\atm\action\AtmAction.class

     文件       4811  2020-05-08 10:37  JavaApplication1\build\classes\team\fzn\atm\dao\AtmDao.class

     文件        780  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney$1.class

     文件        780  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney$2.class

     文件        780  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney$3.class

     文件        780  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney$4.class

     文件        780  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney$5.class

     文件        780  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney$6.class

     文件       7377  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney.class

     文件       8762  2020-05-08 09:45  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney.form

     文件       1371  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney2$1.class

     文件        787  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney2$2.class

     文件        787  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney2$3.class

     文件        860  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney2$4.class

     文件        859  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney2$5.class

     文件       6681  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney2.class

     文件       7602  2020-05-08 10:54  JavaApplication1\build\classes\team\fzn\atm\frame\DrawMoney2.form

     文件        752  2020-05-08 10:53  JavaApplication1\build\classes\team\fzn\atm\frame\Login$1.class

     文件        752  2020-05-08 10:53  JavaApplication1\build\classes\team\fzn\atm\frame\Login$2.class

     文件        547  2020-05-08 10:53  JavaApplication1\build\classes\team\fzn\atm\frame\Login$3.class

     文件       7127  2020-05-08 10:53  JavaApplication1\build\classes\team\fzn\atm\frame\Login.class

     文件       6226  2020-05-08 09:36  JavaApplication1\build\classes\team\fzn\atm\frame\Login.form

     文件        752  2020-05-08 10:53  JavaApplication1\build\classes\team\fzn\atm\frame\Menum$1.class

     文件        752  2020-05-08 10:53  JavaApplication1\build\classes\team\fzn\atm\frame\Menum$2.class

     文件        752  2020-05-08 10:53  JavaApplication1\build\classes\team\fzn\atm\frame\Menum$3.class

     文件        752  2020-05-08 10:53  JavaApplication1\build\classes\team\fzn\atm\frame\Menum$4.class

     文件        752  2020-05-08 10:53  JavaApplication1\build\classes\team\fzn\atm\frame\Menum$5.class

............此处省略92个文件信息

评论

共有 条评论