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

上传人:b****2 文档编号:170855 上传时间:2023-04-28 格式:DOCX 页数:47 大小:24.10KB
下载 相关 举报
Java银行管理系统源代码Word格式.docx_第1页
第1页 / 共47页
Java银行管理系统源代码Word格式.docx_第2页
第2页 / 共47页
Java银行管理系统源代码Word格式.docx_第3页
第3页 / 共47页
Java银行管理系统源代码Word格式.docx_第4页
第4页 / 共47页
Java银行管理系统源代码Word格式.docx_第5页
第5页 / 共47页
Java银行管理系统源代码Word格式.docx_第6页
第6页 / 共47页
Java银行管理系统源代码Word格式.docx_第7页
第7页 / 共47页
Java银行管理系统源代码Word格式.docx_第8页
第8页 / 共47页
Java银行管理系统源代码Word格式.docx_第9页
第9页 / 共47页
Java银行管理系统源代码Word格式.docx_第10页
第10页 / 共47页
Java银行管理系统源代码Word格式.docx_第11页
第11页 / 共47页
Java银行管理系统源代码Word格式.docx_第12页
第12页 / 共47页
Java银行管理系统源代码Word格式.docx_第13页
第13页 / 共47页
Java银行管理系统源代码Word格式.docx_第14页
第14页 / 共47页
Java银行管理系统源代码Word格式.docx_第15页
第15页 / 共47页
Java银行管理系统源代码Word格式.docx_第16页
第16页 / 共47页
Java银行管理系统源代码Word格式.docx_第17页
第17页 / 共47页
Java银行管理系统源代码Word格式.docx_第18页
第18页 / 共47页
Java银行管理系统源代码Word格式.docx_第19页
第19页 / 共47页
Java银行管理系统源代码Word格式.docx_第20页
第20页 / 共47页
亲,该文档总共47页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

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

《Java银行管理系统源代码Word格式.docx》由会员分享,可在线阅读,更多相关《Java银行管理系统源代码Word格式.docx(47页珍藏版)》请在冰点文库上搜索。

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

this.personId=personId;

publicintgetAccountType(){

returnaccountType;

publicvoidsetAccountType(intaccountType){

this.accountType=accountType;

publicdoublegetBalance(){

returnbalance;

publicvoidsetBalance(doublebalance){

this.balance=balance;

publicintgetId(){

returnid;

publicvoidsetId(intid){

this.id=id;

publicdoublegetCeiling(){

returnceiling;

publicvoidsetCeiling(doubleceiling){

this.ceiling=ceiling;

//无参数构造方法

publicaccounts(){

//构造方法

publicaccounts(Stringpassword,Stringname,StringpersonId,intaccountType,

doublebalance,doubleceiling){

super();

//存款

publicvoiddeposit(doublemoney){

balance+=money;

//取款

publicvoidwithdraw(doublemoney){

if(accountType==1){

if((balance+ceiling)<

money){

对不起,已超出您的信用额度!

"

);

}

else{

balance-=money;

}else{

if(balance<

对不起,账户余额不足!

}else{

}

}

DBoper.java

packageDB;

importjava.sql.*;

import

importAccount.accounts;

publicclassDBoper{

privateConnectionconn=null;

privateStatementst=null;

privatePreparedStatementpstmt=null;

privateResultSetrs=null;

privateArrayList<

accounts>

result;

//连接数据库

publicConnectiongetConnection(){

try{

Class.forName(

conn=

}catch(Exceptione){

数据库连接失败"

returnconn;

}

//修改删除用户数据

publicbooleanaccountDataUpdate(Stringsql){

conn=getConnection();

pstmt=conn.prepareStatement(sql);

pstmt.executeUpdate();

数据更新成功"

conn.close();

returntrue;

}catch(SQLExceptione){

e.printStackTrace();

更新失败"

returnfalse;

//依据id来修改记录

publicbooleandataupdateid(accountsuser,intid){

Stringsql="

updateaccountsetusername=,userpwd=,personId=,accountType=,balance=,ceiling=whereid="

+id;

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());

操作成功"

catch(SQLExceptione){

操作失败"

//插入用户数据

publicbooleanaccountDataInsert(accountsaccount){

pstmt=conn.prepareStatement("

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.setDouble(6,account.getCeiling());

新用户数据插入成功"

插入失败"

//查询数据

publicResultSetdataquery(Stringsql){

rs=pstmt.executeQuery();

检索失败"

returnrs;

publicResultSettestlist(){

select*fromaccountwhereid=1001"

;

sql);

publicArrayList<

testt(intid){

ArrayList<

list=newArrayList<

();

select*fromaccountwhereid="

+id;

while(rs.next()){

accountsuser=newaccounts();

user.setName(rs.getString("

username"

));

user.setPassword(rs.getString("

userpwd"

user.setPersonId(rs.getString("

personId"

user.setAccountType(rs.getInt("

accountType"

user.setBalance(rs.getDouble("

balance"

user.setCeiling(rs.getDouble("

ceiling"

list.add(user);

returnlist;

//根据卡号和密码验证用户是否存在

publicbooleanverify(intid,Stringpassword){

select*fromaccountwhereid=anduserpwd="

pstmt.setInt(1,id);

pstmt.setString(2,password);

if(rs.next()){

returntrue;

returnfalse;

/**

*登录验证

*/

publicaccountsverifyAccount(intid,Stringpassword){

booleanflag=verify(id,password);

if(flag){

accountsaccount=queryByIDandPassword(id,password);

returnaccount;

else

{

用户不存在!

returnnull;

//根据卡号和密码查询信息

publicaccountsqueryByIDandPassword(intid,Stringpassword){

accountsaccount=newaccounts();

account.setId(rs.getInt("

id"

account.setName(rs.getString("

account.setPassword(rs.getString("

account.setPersonId(rs.getString("

account.setAccountType(rs.getInt("

account.setBalance(rs.getDouble("

account.setCeiling(rs.getDouble("

//根据卡号查询信息

publicaccountsqueryByID(intid){

publicstaticvoidmain(String[]args){

//TODOAuto-generatedmethodstub

DBoperop=newDBoper();

list=op.testt(1001);

for(inti=0;

i<

list.size();

i++){

accountsuser=newaccounts();

user=list.get(i);

user.getName());

user.getPassword());

user.getPersonId());

user.getAccountType());

user.getBalance());

user.getCeiling());

//图像界面文件夹

DN_SYSTEM

Default.java//主界面

packageDN_SYSTEM;

importDB.DBoper;

publicclassDefaultextendsJFrameimplementsActionListener{

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.setLayout(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.setBounds(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(210,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.setDefaultCloseOperation(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();

//查询余额

if(e.getSource().equals(btn3)){

GetBalancegetbalance=newGetBalance();

getbalance.getBalance();

//转账服务

if(e.getSource().equals(btn4)){

TransferAccountstranfer=newTransferAccounts();

tranfer.transferAccounts();

//注销账户

if(e.getSource().equals(btn5)){

deletefromaccountwhereid="

+account.getId();

booleanflag=db.accountDataUpdate(sql);

if(flag){

JOptionPane.showMessageDialog(this,"

注销成功!

注销

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 总结汇报 > 学习总结

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

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