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