ImageVerifierCode 换一换
格式:DOCX , 页数:34 ,大小:35.07KB ,
资源ID:2275211      下载积分:150 文钱
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,省得不是一点点
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.wenke99.com/d-2275211.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Java-银行管理系统源代码.docx)为本站会员(11****ws)主动上传,文客久久仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知文客久久(发送邮件至hr@wenke99.com或直接QQ联系客服),我们立即给予删除!

Java-银行管理系统源代码.docx

1、Java 小型银行管理系统源代码(图形界面)accounts.javapackage Account;public class accounts protected int id;/银行账号protected String password;/用户密码protected String name;/用户型号protected String personId;/身份账号protected int accountType;/账号类型,0 代表储蓄卡,1 代表信用卡protected double balance;/账户余额。之所以定义为 protected 是让他的子类可以直接用,不需要通过方法来赋

2、值。protected double ceiling;public String getPassword()return password;public void setPassword(String password)this.password=password;public String getName()return name;public void setName(String name)this.name=name;public String getPersonId()return personId;public void setPersonId(String personId)th

3、is.personId=personId;public int getAccountType()return accountType;public void setAccountType(int accountType)this.accountType=accountType;public double getBalance()return balance;public void setBalance(double balance)this.balance=balance;public int getId()return id;public void setId(int id)this.id=

4、id;public double getCeiling()return ceiling;public void setCeiling(double ceiling)this.ceiling=ceiling;/无参数构造方法public accounts()/构造方法public accounts(String password,String name,String personId,int accountType,double balance,double ceiling)super();this.password=password;this.name=name;this.personId=p

5、ersonId;this.accountType=accountType;this.balance=balance;this.ceiling=ceiling;/存款public void deposit(double money)balance+=money;/取款public void withdraw(double money)if(accountType=1)if(balance+ceiling) result;/连接数据库public Connection getConnection()tryClass.forName(“com.mysql.jdbc.Driver“);conn=Dri

6、verManager.getConnection(“jdbc:mysql:/localhost:3306/bankmanager?useUnicode=truecatch(Exception e)System.out.println(“数据库连接失败“);return conn;/修改 删除用户数据public boolean accountDataUpdate(String sql)conn=getConnection();trypstmt=conn.prepareStatement(sql);pstmt.executeUpdate();/System.out.println(“数据更新成功

7、“);conn.close();return true;catch(SQLException e)e.printStackTrace();/System.out.println(“更新失败“);return false;/依据 id 来修改记录public boolean dataupdateid(accounts user, int id) conn = getConnection();try String sql = “update account set username=?,userpwd=?,personId=?,accountType=?,balance=?,ceiling=? w

8、here id=“+ id;pstmt = conn.prepareStatement(sql);pstmt.setString(1, user.getName();pstmt.setString(2, user.getPassword();pstmt.setString(3, user.getPersonId();pstmt.setInt(4, user.getAccountType();pstmt.setDouble(5, user.getBalance();pstmt.setDouble(6, user.getCeiling();pstmt.executeUpdate();System.

9、out.println(“操作成功“);return true;catch (SQLException e) e.printStackTrace();System.out.println(“操作失败“);return false;/插入用户数据public boolean accountDataInsert(accounts account)conn=getConnection();trypstmt=conn.prepareStatement(“insert into account (username,userpwd,personId,accountType,balance,ceiling)

10、 values (?,?,?,?,?,?)“);pstmt.setString(1, account.getName();pstmt.setString(2, account.getPassword();pstmt.setString(3, account.getPersonId();pstmt.setInt(4, account.getAccountType();pstmt.setDouble(5, account.getBalance();pstmt.setDouble(6, account.getCeiling();pstmt.executeUpdate();System.out.pri

11、ntln(“新用户数据插入成功“);conn.close();return true;catch(SQLException e)e.printStackTrace();System.out.println(“插入失败“);return false;/查询数据public ResultSet dataquery(String sql) conn = getConnection();try pstmt = conn.prepareStatement(sql);rs = pstmt.executeQuery();catch (SQLException e) e.printStackTrace();S

12、ystem.out.println(“检索失败“);return rs;public ResultSet testlist() try String sql = “select * from account where id =1001“;pstmt = conn.prepareStatement(sql);System.out.println(sql);rs = pstmt.executeQuery(); catch (SQLException e) e.printStackTrace();System.out.println(“检索失败“);return rs;public ArrayLi

13、st testt(int id) ArrayList list = new ArrayList();conn = getConnection();try String sql = “select * from account where id=“ + id;pstmt = conn.prepareStatement(sql);rs = pstmt.executeQuery();while (rs.next() accounts user = new accounts();user.setName(rs.getString(“username“);user.setPassword(rs.getS

14、tring(“userpwd“);user.setPersonId(rs.getString(“personId“);user.setAccountType(rs.getInt(“accountType“);user.setBalance(rs.getDouble(“balance“);user.setCeiling(rs.getDouble(“ceiling“);list.add(user);catch (SQLException e) e.printStackTrace();System.out.println(“检索失败“);return list;/根据卡号和密码验证用户是否存在pub

15、lic boolean verify(int id,String password)conn=getConnection();trypstmt=conn.prepareStatement(“select * from account where id=? and userpwd=?“);pstmt.setInt(1, id);pstmt.setString(2, password);rs=pstmt.executeQuery();if(rs.next()return true;elsereturn false;catch(SQLException e)e.printStackTrace();r

16、eturn false;/* 登录验证*/public accounts verifyAccount(int id, String password) boolean flag = verify(id, password);if(flag)accounts account=queryByIDandPassword(id, password);return account;elseSystem.out.println(“用户不存在!“);return null;/根据卡号和密码查询信息public accounts queryByIDandPassword(int id,String passw

17、ord)conn=getConnection();trypstmt=conn.prepareStatement(“select * from account where id=? and userpwd=?“);pstmt.setInt(1, id);pstmt.setString(2, password);rs=pstmt.executeQuery();accounts account=new accounts();while(rs.next()account.setId(rs.getInt(“id“);account.setName(rs.getString(“username“);acc

18、ount.setPassword(rs.getString(“userpwd“);account.setPersonId(rs.getString(“personId“);account.setAccountType(rs.getInt(“accountType“);account.setBalance(rs.getDouble(“balance“);account.setCeiling(rs.getDouble(“ceiling“);return account;catch(SQLException e)e.printStackTrace();return null;/根据卡号查询信息pub

19、lic accounts queryByID(int id)conn=getConnection();trypstmt=conn.prepareStatement(“select * from account where id=?“);pstmt.setInt(1, id);rs=pstmt.executeQuery();accounts account=new accounts();while(rs.next()account.setId(rs.getInt(“id“);account.setName(rs.getString(“username“);account.setPassword(

20、rs.getString(“userpwd“);account.setPersonId(rs.getString(“personId“);account.setAccountType(rs.getInt(“accountType“);account.setBalance(rs.getDouble(“balance“);account.setCeiling(rs.getDouble(“ceiling“);return account;catch(SQLException e)e.printStackTrace();return null;public static void main(Strin

21、g args) / TODO Auto-generated method stubDBoper op=new DBoper();ArrayList list=op.testt(1001);for(int i=0;ilist.size();i+)accounts user=new accounts();user=list.get(i);System.out.println(user.getName();System.out.println(user.getPassword();System.out.println(user.getPersonId();System.out.println(use

22、r.getAccountType();System.out.println(user.getBalance();System.out.println(user.getCeiling();/图像界面文件夹DN_SYSTEMDefault.java /主界面package DN_SYSTEM;import java.awt.Color;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import ja

23、vax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.WindowConstants;import Account.accounts;import DB.DBoper;public class Default extends JFrame implements ActionListeneraccounts account=DN_ATM.client;DBoper db=new DBoper();private J

24、Frame jf;private JButton btn0,btn1,btn2,btn3,btn4,btn5;private Container c;public void defaltDemo() /添加主界面卡片/DN_ATM.id;int id=DN_ATM.id;/account=db.queryByID(id);jf=new JFrame(“DEFAULT“);c=jf.getContentPane();c.setLayout(null);c.setBackground(new Color(119,119,253);JLabel lblwel = new JLabel(“欢迎“+ac

25、count.getName()+“用达能银行 ATM 系统“);lblwel.setBounds(20, 15, 350, 30);c.add(lblwel);JLabel lblwel1 = new JLabel(“请选择您需要的交易类型“);lblwel1.setBounds(120, 45, 350, 30);c.add(lblwel1);btn1 = new JButton(“取款服务“);btn1.addActionListener(this);btn1.setBounds(70, 90, 100, 30);c.add(btn1);btn2=new JButton(“存款服务 “);btn2.addActionListener(this);btn2.setBounds(210, 90, 100, 30);c.add(btn2);btn3 = new JButton(“查询余额“);btn3.addActionListener(this);btn3.setBounds(70, 150, 100, 30);c.add(btn3);

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。