欢迎来到天天文库
浏览记录
ID:20642340
大小:35.07 KB
页数:34页
时间:2018-10-14
《java-银行管理系统源代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Java小型银行管理系统源代码(图形界面)accounts.javapackageAccount;publicclassaccounts{protectedintid;//银行账号protectedStringpassword;//用户密码protectedStringname;//用户型号protectedStringpersonId;//身份账号protectedintaccountType;//账号类型,0代表储蓄卡,1代表信用卡protecteddoublebalance;//账户余额。之所以定义为protected是让他的子类可以直接用,不需要通过方法来赋值。protect
2、eddoubleceiling;publicStringgetPassword(){returnpassword;}publicvoidsetPassword(Stringpassword){this.password=password;}publicStringgetName(){returnname;}publicvoidsetName(Stringname){this.name=name;}publicStringgetPersonId(){returnpersonId;}publicvoidsetPersonId(StringpersonId){this.personId=p
3、ersonId;}publicintgetAccountType(){returnaccountType;}publicvoidsetAccountType(intaccountType){this.accountType=accountType;}publicdoublegetBalance(){returnbalance;}publicvoidsetBalance(doublebalance){this.balance=balance;}publicintgetId(){returnid;}publicvoidsetId(intid){this.id=id;}publicdoub
4、legetCeiling(){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.
5、accountType=accountType;this.balance=balance;this.ceiling=ceiling;}//存款publicvoiddeposit(doublemoney){balance+=money;}//取款publicvoidwithdraw(doublemoney){if(accountType==1){if((balance+ceiling)6、println("对不起,账户余额不足!");}else{balance-=money;}}}}DBoper.javapackageDB;importjava.sql.*;importjava.util.ArrayList;importAccount.accounts;publicclassDBoper{privateConnectionconn=null;privateStatementst=null;privatePreparedStatementpstmt=null;privateResultSetrs=null;privateArrayListresult7、;//连接数据库publicConnectiongetConnection(){try{Class.forName("com.mysql.jdbc.Driver");conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/bankmanager?useUnicode=true&characterEncoding=utf8","root","xuewei");}catch(Exception
6、println("对不起,账户余额不足!");}else{balance-=money;}}}}DBoper.javapackageDB;importjava.sql.*;importjava.util.ArrayList;importAccount.accounts;publicclassDBoper{privateConnectionconn=null;privateStatementst=null;privatePreparedStatementpstmt=null;privateResultSetrs=null;privateArrayListresult
7、;//连接数据库publicConnectiongetConnection(){try{Class.forName("com.mysql.jdbc.Driver");conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/bankmanager?useUnicode=true&characterEncoding=utf8","root","xuewei");}catch(Exception
此文档下载收益归作者所有