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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

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

1、Java银行管理系统源代码Java小型银行管理系统源代码(图形界面)accounts.javapackageAccount;publicclassaccounts protectedintid;/银行账号 protectedStringpassword;/用户密码 protectedStringname;/用户型号 protectedStringpersonId;/身份账号 protectedintaccountType;/账号类型,0代表储蓄卡,1代表信用卡 protecteddoublebalance;/账户余额。之所以定义为protected是让他的子类可以直接用,不需要通过方法来赋值。

2、 protecteddoubleceiling; publicStringgetPassword() returnpassword; publicvoidsetPassword(Stringpassword) this.password=password; publicStringgetName() returnname; publicvoidsetName(Stringname) this.name=name; publicStringgetPersonId() returnpersonId; publicvoidsetPersonId(StringpersonId) this.person

3、Id=personId; publicintgetAccountType() returnaccountType; publicvoidsetAccountType(intaccountType) this.accountType=accountType; publicdoublegetBalance() returnbalance; publicvoidsetBalance(doublebalance) this.balance=balance; publicintgetId() returnid; publicvoidsetId(intid) this.id=id; publicdoubl

4、egetCeiling() returnceiling; publicvoidsetCeiling(doubleceiling) this.ceiling=ceiling; /无参数构造方法 publicaccounts() /构造方法 publicaccounts(Stringpassword,Stringname,StringpersonId,intaccountType, doublebalance,doubleceiling) super(); this.password=password; this.name=name; this.personId=personId; this.ac

5、countType=accountType; this.balance=balance; this.ceiling=ceiling; /存款 publicvoiddeposit(doublemoney) balance+=money; /取款 publicvoidwithdraw(doublemoney) if(accountType=1) if(balance+ceiling)money) 对不起,已超出您的信用额度!); else balance-=money; else if(balancemoney) 对不起,账户余额不足!); else balance-=money; DBoper.

6、javapackageDB;importjava.sql.*;importimportAccount.accounts;publicclassDBoper privateConnectionconn=null; privateStatementst=null; privatePreparedStatementpstmt=null; privateResultSetrs=null; privateArrayListresult; /连接数据库 publicConnectiongetConnection() try Class.forName( conn= catch(Exceptione) 数据

7、库连接失败); returnconn; /修改删除用户数据 publicbooleanaccountDataUpdate(Stringsql) conn=getConnection(); try pstmt=conn.prepareStatement(sql); pstmt.executeUpdate(); 数据更新成功); conn.close(); returntrue; catch(SQLExceptione) e.printStackTrace(); 更新失败); returnfalse; /依据id来修改记录 publicbooleandataupdateid(accountsuse

8、r,intid) conn=getConnection(); try Stringsql=updateaccountsetusername=,userpwd=,personId=,accountType=,balance=,ceiling=whereid= +id; pstmt=conn.prepareStatement(sql); pstmt.setString(1,user.getName(); pstmt.setString(2,user.getPassword(); pstmt.setString(3,user.getPersonId(); pstmt.setInt(4,user.ge

9、tAccountType(); pstmt.setDouble(5,user.getBalance(); pstmt.setDouble(6,user.getCeiling(); pstmt.executeUpdate(); 操作成功); returntrue; catch(SQLExceptione) e.printStackTrace(); 操作失败); returnfalse; /插入用户数据 publicbooleanaccountDataInsert(accountsaccount) conn=getConnection(); try pstmt=conn.prepareStatem

10、ent(insertintoaccount(username,userpwd,personId,accountType,balance,ceiling)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.setDoub

11、le(6,account.getCeiling(); pstmt.executeUpdate(); 新用户数据插入成功); conn.close(); returntrue; catch(SQLExceptione) e.printStackTrace(); 插入失败); returnfalse; /查询数据 publicResultSetdataquery(Stringsql) conn=getConnection(); try pstmt=conn.prepareStatement(sql); rs=pstmt.executeQuery(); catch(SQLExceptione) e.

12、printStackTrace(); 检索失败); returnrs; publicResultSettestlist() try Stringsql=select*fromaccountwhereid=1001; pstmt=conn.prepareStatement(sql); sql); rs=pstmt.executeQuery(); catch(SQLExceptione) e.printStackTrace(); 检索失败); returnrs; publicArrayListtestt(intid) ArrayListlist=newArrayList(); conn=getCo

13、nnection(); try Stringsql=select*fromaccountwhereid=+id; pstmt=conn.prepareStatement(sql); rs=pstmt.executeQuery(); while(rs.next() accountsuser=newaccounts(); user.setName(rs.getString(username); user.setPassword(rs.getString(userpwd); user.setPersonId(rs.getString(personId); user.setAccountType(rs

14、.getInt(accountType); user.setBalance(rs.getDouble(balance); user.setCeiling(rs.getDouble(ceiling); list.add(user); catch(SQLExceptione) e.printStackTrace(); 检索失败); returnlist; /根据卡号和密码验证用户是否存在 publicbooleanverify(intid,Stringpassword) conn=getConnection(); try pstmt=conn.prepareStatement(select*fro

15、maccountwhereid=anduserpwd=); pstmt.setInt(1,id); pstmt.setString(2,password); rs=pstmt.executeQuery(); if(rs.next() returntrue; else returnfalse; catch(SQLExceptione) e.printStackTrace(); returnfalse; /* *登录验证 */ publicaccountsverifyAccount(intid,Stringpassword) booleanflag=verify(id,password); if(

16、flag) accountsaccount=queryByIDandPassword(id,password); returnaccount; else 用户不存在!); returnnull; /根据卡号和密码查询信息 publicaccountsqueryByIDandPassword(intid,Stringpassword) conn=getConnection(); try pstmt=conn.prepareStatement(select*fromaccountwhereid=anduserpwd=); pstmt.setInt(1,id); pstmt.setString(2,

17、password); rs=pstmt.executeQuery(); accountsaccount=newaccounts(); while(rs.next() account.setId(rs.getInt(id); account.setName(rs.getString(username); account.setPassword(rs.getString(userpwd); account.setPersonId(rs.getString(personId); account.setAccountType(rs.getInt(accountType); account.setBal

18、ance(rs.getDouble(balance); account.setCeiling(rs.getDouble(ceiling); returnaccount; catch(SQLExceptione) e.printStackTrace(); returnnull; /根据卡号查询信息 publicaccountsqueryByID(intid) conn=getConnection(); try pstmt=conn.prepareStatement(select*fromaccountwhereid=); pstmt.setInt(1,id); rs=pstmt.executeQ

19、uery(); accountsaccount=newaccounts(); while(rs.next() account.setId(rs.getInt(id); account.setName(rs.getString(username); account.setPassword(rs.getString(userpwd); account.setPersonId(rs.getString(personId); account.setAccountType(rs.getInt(accountType); account.setBalance(rs.getDouble(balance);

20、account.setCeiling(rs.getDouble(ceiling); returnaccount; catch(SQLExceptione) e.printStackTrace(); returnnull; publicstaticvoidmain(Stringargs) /TODOAuto-generatedmethodstub DBoperop=newDBoper(); ArrayListlist=op.testt(1001); for(inti=0;ilist.size();i+) accountsuser=newaccounts(); user=list.get(i);

21、user.getName(); user.getPassword(); user.getPersonId(); user.getAccountType(); user.getBalance(); user.getCeiling(); /图像界面文件夹DN_SYSTEMDefault.java/主界面packageDN_SYSTEM;importimportimportimportimportimportimportimportimportimportimportAccount.accounts;importDB.DBoper;publicclassDefaultextendsJFrameimp

22、lementsActionListener accountsaccount=DN_ATM.client; DBoperdb=newDBoper(); privateJFramejf; privateJButtonbtn0,btn1,btn2,btn3,btn4,btn5; privateContainerc; publicvoiddefaltDemo() /添加主界面卡片 /DN_ATM.id; intid=DN_ATM.id; /account=db.queryByID(id); jf=newJFrame(DEFAULT); c=jf.getContentPane(); c.setLayou

23、t(null); c.setBackground(newColor(119,119,253); JLabellblwel=newJLabel(欢迎+account.getName()+用达能银行ATM系统); lblwel.setBounds(20,15,350,30); c.add(lblwel); JLabellblwel1=newJLabel(请选择您需要的交易类型); lblwel1.setBounds(120,45,350,30); c.add(lblwel1); btn1=newJButton(取款服务); btn1.addActionListener(this); btn1.se

24、tBounds(70,90,100,30); c.add(btn1); btn2=newJButton(存款服务); btn2.addActionListener(this); btn2.setBounds(210,90,100,30); c.add(btn2); btn3=newJButton(查询余额); btn3.addActionListener(this); btn3.setBounds(70,150,100,30); c.add(btn3); btn4=newJButton(转账服务); btn4.addActionListener(this); btn4.setBounds(21

25、0,150,100,30); c.add(btn4); btn5=newJButton(注销账户); btn5.addActionListener(this); btn5.setBounds(70,210,100,30); c.add(btn5); btn0=newJButton(退出操作); btn0.addActionListener(this); btn0.setBounds(210,210,100,30); c.add(btn0); jf.setVisible(true); jf.setResizable(false);jf.setSize(400,300);jf.setDefault

26、CloseOperation(WindowConstants.EXIT_ON_CLOSE); /事件处理 Override publicvoidactionPerformed(ActionEvente) /取款服务 if(e.getSource().equals(btn1) OutMoneyoutmoney=newOutMoney(); outmoney.outMoney(); jf.dispose(); /存款服务 if(e.getSource().equals(btn2) InMoneyinmoney=newInMoney(); inmoney.InMoney(); jf.dispose(

27、); /查询余额 if(e.getSource().equals(btn3) GetBalancegetbalance=newGetBalance(); getbalance.getBalance(); jf.dispose(); /转账服务 if(e.getSource().equals(btn4) TransferAccountstranfer=newTransferAccounts(); tranfer.transferAccounts(); jf.dispose(); /注销账户 if(e.getSource().equals(btn5) Stringsql=deletefromaccountwhereid=+account.getId(); booleanflag=db.accountDataUpdate(sql); if(flag) JOptionPane.showMessageDialog(this,注销成功!); else JOptionPane.showMessageDialog(this,注销

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2