版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
ATM標(biāo)準(zhǔn)管理系統(tǒng)java窗口界面
BAM銀行賬戶管理系統(tǒng)(ATM管理系統(tǒng))
本系統(tǒng)采用JAVA語言并在eclipse環(huán)境下編
寫測(cè)試完成,涉及類的概念,以及面向?qū)ο蟮膸?/p>
大特性(繼承,封裝,多態(tài),抽象),也有異常
處理機(jī)制,采用集合(更好)存儲(chǔ)賬戶數(shù)據(jù),基
本可以滿足大多數(shù)BAM系統(tǒng)的相關(guān)實(shí)現(xiàn),且代碼
內(nèi)標(biāo)注大量注釋,讀者可以很輕松地理解相關(guān)邏
輯,大家可以開心參考。
系統(tǒng)簡介:
特點(diǎn):采用窗口界面風(fēng)格,而不是傳統(tǒng)的命令行、控制臺(tái)運(yùn)作模式
1、JAVA類的面相對(duì)象的應(yīng)用,擁有異常處理
機(jī)制,不會(huì)因?yàn)檩斎脲e(cuò)誤而導(dǎo)致程序崩潰
2、主要有7個(gè)類,即①Account(賬戶類)
②SaveAccount(儲(chǔ)蓄
賬戶類):不能透支
③CreditAccount(信
用賬戶類):可以透支
?Bank(銀行類)
⑤
ATMOpenAccountFrame
(開戶窗口頁面)
@ATMLoginFrame(登
錄窗口頁面)
⑦ATMMainFrame(操
作窗口頁面)
帶有完善的相關(guān)信息提示彈出窗口見
F面截圖
類的具體屬性級(jí)行為見代碼
3、各個(gè)類之間的相互關(guān)系,涉及繼承、封
裝、多態(tài)、抽象,在多態(tài)中又涉及重載和重
寫,請(qǐng)讀者注意相關(guān)聯(lián)系(關(guān)注注釋)
4、可以實(shí)現(xiàn)數(shù)據(jù)保存功能,數(shù)據(jù)將保存在
文件中(即當(dāng)你注冊(cè)了一個(gè)賬戶,下次再登
陸系統(tǒng)時(shí),可以實(shí)現(xiàn)與上次最后的操作
相銜接)
5、賬戶號(hào)自動(dòng)生成,比較符合現(xiàn)實(shí)
6、主要功能有:1.開戶
2.查詢賬戶余額
3.存款
4.取款
5.轉(zhuǎn)賬(一個(gè)賬戶到另一個(gè)賬
戶)等……
7、運(yùn)行時(shí)界面簡示
1.初始界面(賬戶登錄)
2.賬戶登錄后界面
3.相關(guān)信息提示一覽(只列舉一部分)
1、查詢:2、存款:
目盤作界囪
3、取款:
國掾作界面
破戶姓名:旅司望余額:570.0
4、轉(zhuǎn)賬:
賬戶姓名:張可望余額:550.0
4、用戶開戶界面:
注意事項(xiàng):
1、本系統(tǒng)采用的編程環(huán)境是JDK1.7,jer7。
所以,運(yùn)行代碼需要保持電腦上所裝的JDK為
1.7以上版本,如有報(bào)錯(cuò),只需換個(gè)高一點(diǎn)的版
本即可。注意:第一次裝JDK,要配置環(huán)境變量
(請(qǐng)查閱相關(guān)資料,比較簡單)
2、本系統(tǒng)代碼涉及到包,所以如果報(bào)名不一
致就會(huì)報(bào)錯(cuò),解決方法:修改一下包名即可
3、建議把各個(gè)類寫在同一個(gè)包下面,且每一
個(gè)類單獨(dú)寫一個(gè)java文件,如下圖:
3Java-BAM07/src/com/qx/ATMMainFrame.java-EclipseSDK
FileEditSourceRefactorNavigateSearchProjectRunWindowHelp
「二、勢(shì)▼Q▼q▼:咨審6▼一甲CD闿回管"i▼j▼0s
-?PackageExplorer京、廠B由A1MLoginFrame.java“AlMMainFrame.javaAlMUoenAc(
D82jblName=newJLat
BAM▲83jblMsg.setText(,
BAM0284)
BAM0385)
BAM0486
BAM0587);
BAM06
88//給取款按鈕注冊(cè)監(jiān)聽器
:JBAM07
89jbWithdraw.addActionListenei
90s
田com.qxnewActionListener(){
UAccount.java191-publicvoidactionPe
,物ATMLoginFrame.java192Strings=JOpti
.ATMMainFrame.java193doublemoney=Dot
ATMOpenAccountFrar
I95bank.withdraw(ac
Bankjava/*JOptionPane.st
|jCreditAccount.java■96JOptic
[j,SavingAccount.javaJ97jblName=newJLat
JRESystemLibrary[jre7]198
3accounttxt
\
4、在運(yùn)行程序前,需要在項(xiàng)目下面新建一個(gè)
account.txt(用來保存數(shù)據(jù))文件(如上圖),
并在其中寫入至少一個(gè)賬戶信息,(如下圖,其
中每項(xiàng)代表的意思,請(qǐng)讀者參照代碼內(nèi)的注釋),
否則在初始化的時(shí)候會(huì)因?yàn)檎也坏劫~戶信息,從
而產(chǎn)生異常。
OJava-BAM04/account.txt-EdipseSDK
FileEditNavigateSearchProjectRunWindowHelp
匚j玲▼。▼亙ini
上PackageExplorer2accounttxt
張可里,
IS生l|1001r1001,321323,0,510.0
會(huì)BAM
?BAM02
BBAM03
審BAM04
0src
出com.qx
J.Accountjava
(jjATM.java
|j(Bankjava
.CreditAccountjava
[£SavingAccountjava
■KJRESystemLibrary[jre7]
[3|account.txt
系統(tǒng)源碼:
Account類
packagecom.qx;
importjavax.swing.JOptionPane;
/★★
*賬戶類:包含兩種賬戶類型一>1.儲(chǔ)蓄賬戶
2.信用賬戶
*/
publicabstractclassAccount{
//屬性
protectedlongid;
protectedStringpassword;
protectedStringname;
protectedStringpersonld;
protectedStringaccountType;
protecteddoublebalance;
//構(gòu)造方法
publicAccount(){
super();
)
publicAccount(longid,String
password,StringnamerString
personld,
Stringtype,doublebalance){
super();
this.id=id;
this.password=password;
=name;
this.personld=personld;
this.accountType=type;
this.balance=balance;
}
//getXxx,setXxx方法
publiclonggetld(){
returnid;
)
publicvoidsetld(longid){
this.id=id;
)
publicStringgetPassword(){
returnpassword;
)
publicvoidsetPassword(String
password){
this.password=password;
}
publicStringgetName(){
returnname;
)
publicvoidsetName(Stringname){
this.namename;
)
publicStringgetPersonld(){
returnpersonld;
}
publicvoidsetPersonld(String
personld){
this.personld=personld;
)
publicStringgetAccountType(){
returnaccountType;
}
publicvoidsetAccountType(String
accountType){
this.accountType=accountType;
)
publicdoublegetBalance(){
returnbalance;
}
publicvoidsetBalance(double
balance){
this.balance=balance;
)
★★
*存款
*/
publicvoiddeposit(doublemoney){
balance+=money;
)
/*★
*取款(取款方式由賬戶類型決定,所以設(shè)
為抽象方法,相應(yīng)的Account類應(yīng)設(shè)為抽象類)
*/
publicabstractvoid
withdraw(doublemoney);
}
SavingAccount類
packagecom.qx;
importjavax.swing.JOptionPane;
★★
*儲(chǔ)蓄賬戶類
*/
publicclassSavingAccountextends
Account{
//構(gòu)造函數(shù)
publicSavingAccount(){
super();
)
publicSavingAccount(longid,
Stringpassword,Stringnamer
Stringpersonld,String
accountTypeAdoublebalance){
super(idApassword,name,
personld,accountType,balance);
}
〃對(duì)父類的withdraw()實(shí)現(xiàn)
publicvoidwithdraw(double
money){
if(balance<money){
/*System.out.printin("對(duì)不起,
賬戶余額不足!”);*/
JOptionPane.showMessageDialog(nu
11,”對(duì)不起,賬戶余額不足!”,
"信息提示
”,JOptionPane.ERROI^MESSAGE);
}
else
(
balance-=money;
}
}
}
CresitAccount類
packagecom.qx;
importjavax.swing.JOptionPane;
/★★
*信用賬戶類,增加一個(gè)信用額度ceiling屬
性
*/
publicclassCreditAccountextends
Account{
privateintceiling;
//構(gòu)造函數(shù)
publicCreditAccount(){
super();
)
publicCreditAccount(longid,
Stringpassword,Stringname,
Stringpersonld,String
accountType,doublebalance,int
ceiling){
super(idzpassword,name,
personld,accountType,balance);
this.ceiling=ceiling;
)
//getX*x,setXxx方法
publicintgetCeiling(){
returnceiling;
}
publicvoidsetCeiling(intceiling)
(
this.ceiling=ceiling;
)
〃實(shí)現(xiàn)父類的withdraw()
publicvoidwithdraw(double
money){
if((balance+ceiling)<money){
/*System.out.printin("對(duì)不起,
已超出您的信用額度!”);*/
JOptionPane.showMessageDialog(nu
11,”對(duì)不起,已超出您的信用額度!”,
”信息提示
“,JOptionPane.ERROR_MESSAGE);
)
else
(
balance一=money;
)
)
}
Bank類
packagecom.qx;
importjava.io.BufferedReader;
importjava.io.BufferedWriter;
importjava.io.File;
importjava.io.FileNotFoundException;
importjava.io.FileReader;
importjava.io.FileWriter;
importjava.io.lOException;
importjava.util.ArrayList;
importjava.util.Iterator;
importjava.util.List;
importjava.util.Properties;
importjavax.swing.JOptionPane;
/**
*Bank類
*編寫B(tài)ank類,屬性:
1.當(dāng)前所有的賬戶對(duì)象的集合,存放在數(shù)組中
2.當(dāng)前賬戶數(shù)量
方法:
1.用戶開戶,需要的參數(shù):id,密碼,密碼確認(rèn),姓
名,身份證號(hào)碼,賬戶類型,返回新創(chuàng)建的
Account對(duì)象的賬號(hào),
提示:用si.equals(s2)可以比較si,s2
兩個(gè)字符串的值是否相等.賬戶類型是一個(gè)整數(shù),
為0的時(shí)候表示儲(chǔ)蓄賬戶,為1的時(shí)候表示信用
賬戶
2.用戶登錄,參數(shù):id,密碼返回登錄賬戶的賬
號(hào)
3.用戶存款,參數(shù):id,存款數(shù)額,返回void
4.用戶取款,參數(shù):id,取款數(shù)額,返回void
5.查詢余額,參數(shù):id,返回該賬戶的余額
double
用戶會(huì)通過調(diào)用Bank對(duì)象以上的方法來操作自
己的賬戶,請(qǐng)分析各個(gè)方法需要的參數(shù)
*/
publicclassBank{
/*privateAccount[]accounts=new
Account[20];*/
privateListaccountsList;
privateintnumber;〃賬戶數(shù)目
privateintid=1001;〃確定銀行賬號(hào)從
1001開始生成,即第一個(gè)賬戶的賬號(hào)是1001
〃構(gòu)造函數(shù)
publicBank(){.
accountsList=new
ArrayList<Account>();
number=0;
BufferedReaderbufReader=null;
Properties
props二System.getProperties();
String
path二props.getProperty(^user.dir");
try{
bufReader=newBufferedReader(new
FileReader(new
File(path,“account,txt")));
Strings=bufReader.readLine();
while(s!=null){
StringE]str=s.split;
if(str[4].equals("0"))
(
AccountsavingAcc=new
SavingAccount(Long.parseLong(str[0]),
str[1].toStringO,
str[2].toStringO,
str[3]?toString(),str[4]?toString(),
Double.parseDouble(str[51));
accountsList.add(savingAcc);
else
{
AccountcreditAcc=new
CreditAccount(Long.parseLong(str[0]),
str[1].toStringO,
str[2].toStringO,
str[3].toString(),str[4].toString(),
Double.parseDouble(str[5]),5000);
accountsList.add(creditAcc);
)
number++;
id++;
s=bufReader.readLine();
)
}catch(NumberFormatExceptione){
//TODOAuto-generatedcatchblock
e.printStackTraceO;
}catch(FileNotFoundExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}catch(lOExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}finally{
try{
if(bufReader!=null)
(
bufReader.close0;
)
}catch(lOExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
)
)
)
//getXxx,setXxx
publicListgetAccountsO{
returnaccountsList;
)
publicvoidsetAccounts(Listaccounts){
this.accountsList=accounts;
publicintgetNumber(){
returnnumber;
)
publicvoidsetNumber(intnumber){
this,number=number;
}
publicintgetldO{
returnid;
)
publicvoidsetld(intid){
this,id=id;
)
/**
*開戶
*/
publicAccountopenAccount(String
passwdl,Stringpasswd2,Stringname,
Stringpersonld,Stringtype){
〃創(chuàng)建一個(gè)新賬戶
Accountaccount=null;
〃判斷兩次密碼是否一致
if(passwdl.equals(passwd2)){
〃若一致,再判斷賬戶類型(根據(jù)type
的值)
if(type,equals("1")){
〃可令開始余額為10,信用額度為
5000
account=newCreditAccount(id,
passwdl,name,personld,type,10,5000);
)
else
(
account=newSavingAccount(id,
passwdl,name,personld,type,10);
)
〃將賬戶存入賬戶集合accountsList中
accountsList.add(account);
JOptionPane.showMessageDialog(null,
〃開戶成功!??!〃,〃信息提示〃,
JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null,
"您的卡號(hào)為:〃+id+〃\n〃+
〃您的密碼為:
"+passwdl+"\n"+"您的戶名為:”+name+"\n"+
〃您的身份證號(hào)為:
“+personld+"\n"+”您的賬戶類型為:
〃+type+〃\n〃,〃信息提示〃,
JOptionPane.INFORMATION_MESSAGE);
account.accountType=type;
number++;
id++;
returnaccount;〃此時(shí)開戶成功
)
else
(
JOptionPane.showMessageDialog(null,
〃對(duì)不起!您兩次密碼輸入不匹配,開戶失?。?!!
〃信息提示
”,JOptionPane.ERROR_MESSAGE);
returnnull;〃此時(shí)開戶失敗
/**
*保存數(shù)據(jù)
*/
publicvoidsaveAccountDate(){
BufferedWriterbufWriter=null;
try{
Properties
props二System.getProperties0;
String
path=props.getProperty(^user.dir");
Strings=null;
bufWriter=newBufferedWriter(new
FileWriter(new
File(path,“account,txt")));
for(Iteratoriterator=
accountsList.iterator();iterator.hasNext(
);)
{〃若存在賬戶
Accountacc=(Account)
iterator,next();
〃寫入賬戶信息到account.txt
bufWriter.write(acc.id+",");
bufWriter.write(acc.getPassword()+”,");
bufWriter.write(acc.getName()+^,");
bufWriter.write(acc.getPersonId()+”,");
bufWriter.write(acc.getAccountType()+”,
〃);
bufWriter.write(Double.toString(acc.get
Balance()));
bufWriter.newLine()
)
bufWriter.flush();〃清空緩存中的內(nèi)
容
}catch(lOExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
}finally{
try{
if(bufWriter!=null){
bufWriter.close();
)
}catch(lOExceptione){
//TODOAuto-generatedcatchblock
e.printStackTrace();
)
)
)
/**
*登錄驗(yàn)證
*/
publicAccountverifyAccount(longid,
Stringpassword){
Accountaccount=null;
Accountacc=null;
for(Iteratoriterator=
accountsList.iterator();
iterator.hasNext();)
{〃若存在賬戶
acc=(Account)iterator,next();
if(acc!=null){
if(id==acc.getldO&&
password,equals(acc.getPassword())){
account=acc;
break;
)
)
else
(
break;
)
)
returnaccount;
)
/**
*轉(zhuǎn)賬驗(yàn)證(方法的重載)
*/
publicAccountverifyAccount(longid){
Accountaccount=null;
Accountacc=null;
for(Iteratoriterator=
accountsList.iterator();
iterator.hasNext();)
(〃若存在賬戶
acc=(Account)iterator,next();
if(acc!=null){
if(id==acc.getldO){
account=acc;
break;
}
)
else
(
break;
)
)
returnaccount;
)
/**
*轉(zhuǎn)賬
*/
publicvoidtransferAccount(Account
account1,Accountaccount2,doublemoney){
account1.withdraw(money);
account2.deposit(money);
)
/**
*存款
*/
publicvoiddeposit(Accountaccount,
doublemoney){
account,deposit(money);
)
/**
*取款
*/
publicvoidwithdraw(Accountaccount,
doublemoney){
account.withdraw(money);
ATMLoginFrame類
packagecom.qx;
importjava.awt.Dimension;
importjava.awt.GridLayout;
importjava.awt.Toolkit;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjavax.swing.JButton;
importjavax.swing.JFrame;
importjavax.swing.JLabel;
importjavax.swing.JOptionPane;
importjavax.swing.JPanel;
importjavax.swing.JTextField;
publicclassATMLoginFrameextendsJFrame{
privateJLabeljblCardNo,jblPasswd;
privateJTextFieldjtfCardNo,jtfPasswd;
privateJButton
jbOk,jbCancel,jbOpenAccount;
privateJPaneljpl,jp2,jp3,jp4;
privateBankbank;
publicATMLoginFrame(){
bank=newBank();
〃實(shí)例化所有組件
jblCardNo=newJLabel("用戶名:“);
jblPasswd=newJLabel(“密碼?")?
jtfCardNo=newJTextField(20);
jtfPasswd=newJTextField(20);
jb0k=newJButton(“確定");
jbCancel=newJButton(〃取消“);
jbOpenAccount=newJButton(“沒有賬戶,
開戶〃);
jpl=newJPanel()
jp2=newJPanel();
jp3=newJPanel();
jp4=newJPanel();
jpl.add(jblCardNo);
jpl.add(jtfCardNo);
jp2.add(jblPasswd);
jp2.add(jtfPasswd);
jp3.add(jbOk);
jp3.add(jbCancel);
jp4.add(jbOpenAccount);
〃將每行逐行添加到frame中
this,add(jpl);
this.add(jp2);
this.add(jp3);
this.add(jp4);
this.setLayout(newGridLayout(4,
1));〃取消默認(rèn)管理器,設(shè)置為3行1列的網(wǎng)格
布局
Dimension
d二Toolkit.getDefaultToolkit().getScreenSi
ze();
this.setTitle(〃登陸界面〃);
this.setBounds((d.width-300)/2,
(d.height-200)/2,300,200);
this.setDefaultCloseOperation(JFrame.EX
IT_ON_CLOSE);〃設(shè)置關(guān)閉窗口時(shí)JVM同時(shí)推出
this.pack();〃調(diào)整窗口至能容納組件的
最小尺寸
this.setVisible(true);〃設(shè)置窗口可見
this.setResizable(false);〃不能最大化
〃使用匿名內(nèi)部類給2個(gè)按鈕注冊(cè)監(jiān)聽器
jbCancel.addActionListener(
newActionListener0{
publicvoid
actionPerformed(ActionEvente){
dispose();〃關(guān)閉窗口
)
)
);
jbOk.addActionListener(
newActionListener(){
publicvoid
actionPerformed(ActionEvente){
〃取出用戶界面輸入的用戶名和密
碼
long
cardNo=Integer.parselnt(jtfCardNo.getText
0);
String
passwd=jtfPasswd.getText();
〃調(diào)用Bank的相關(guān)方法將二者與正
確的做比對(duì)
Account
account二bank.verifyAccount(cardNo,
passwd);
if(account!=null)〃假如正確,進(jìn)
入操作界面
ATMMainFramemainFrame=new
ATMMainFrame(bank,account);〃進(jìn)入操作界
dispose。;〃關(guān)閉登陸界面
}else{〃假如錯(cuò)誤,使用對(duì)話框提
示錯(cuò)誤信息
JOptionPane.showMessageDialog(null,“卡
號(hào)或密碼錯(cuò)誤〃,〃信息提示
”,JOptionPane.ERROR_MESSAGE);
);
jbOpenAccount.addActionListener(
newActionListener0{
publicvoid
actionPerformed(ActionEventargO){
ATMOpenAccountFrame
openFram=newATMOpenAccountFrame();
dispose。;〃關(guān)閉登陸界面
)
)
);
).
/**
*@paramargs
*/
publicstaticvoidmain(String[]args){
ATMLoginFrameatm=newATMLoginFrame();
ATMMainFrame類
packagecom.qx;
importjava.awt.Dimension;
importjava.awt.FlowLayout;
importjava.awt.GridLayout;
importjava.awt.Toolkit;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjava.util.Scanner;
importjavax.swing.JButton;
importjavax.swing.JFrame;
importjavax.swing.JLabel;
importjavax.swing.JOptionPane;
importjavax.swing.JPanel;
publicclassATMMainFrameextendsJFrame{
privateAccountaccount;
privateBankbank;
privateJButton
jbDeposit,jbWithdraw,jbCancel,jbQuery,jbT
ransfer;
privateJLabeljblMsg,jblName;
privateJPaneljpl,jp2,jp3,jp4;
/**
*@paramargs
*/
publicATMMainFrame(finalBank
bank,AccounttmpA){
this.account=tmpA;
this.bank=bank;
jbQuery=newJButton("查詢”);
jbDeposit=newJButton("存款”);
jbWithdraw=newJButton("取款”);
jbTransfer=newJButton(“轉(zhuǎn)賬");
jbCancel=newJButton("退卡");
jblName=newJLabel("賬戶姓名:
+account.getName());
jblMsg=newJLabel();
jpl=newJPanel();
jp2=newJPanel0;
jp3=newJPanel()
jp4二newJPanel()
jpl.add(jbQuery);
jpl.add(jbDeposit);
jp2.add(jbWithdraw);
jp2.add(jbTransfer);
jp3.add(jbCancel);
jp4.add(jblName);
jp4.add(jblMsg);
〃將每行逐行添加到frame中
this,add(jpl);
this.add(jp2);
this.add(jp3);
this.add(jp4);
this.setLayout(newGridLayout(4,
D);〃取消默認(rèn)管理器,設(shè)置為4行1列的網(wǎng)格
布局
Dimension
d=Toolkit.getDefaultToolkit().getScreenSi
ze();
this.setTitle("操作界〃);
this.setBounds((d.width-300)/2,
(d.height-200)/2,300,200);
this.setDefaultCloseOperation(JFrame.EX
IT_ON_CLOSE);〃設(shè)置關(guān)閉窗口時(shí)JVM同時(shí)推出
//this.pack();〃調(diào)整窗口至能容納組件
的最小尺寸
this.setVisible(true);〃設(shè)置窗口可見
this.setResizable(false);
〃使用匿名內(nèi)部類給查詢按鈕注冊(cè)監(jiān)聽器
jbQuery.addActionListener(
newActionListener(){
publicvoid
actionPerformed(ActionEvente){
JOptionPane.showMessageDialog(null,“您
賬戶的當(dāng)前余額為:"+account.getBalance(),
〃信息提示
〃,JOptionPane.INFORMATION_MESSAGE);
}
)
);
〃給存款按鈕注冊(cè)監(jiān)聽器
jbDeposit.addActionListener(
newActionListener(){
publicvoid
actionPerformed(ActionEventargO){
Strings=
JOptionPane.showInputDialog(“請(qǐng)輸入存款金
額:〃);
double
money=Double.parseDouble((s.equals("")?"0
〃:s));
bank,deposit(account,money);
JOptionPane.showMessageDialog(null,“存
款成功?。?!〃,〃信息提示〃,
JOptionPane.INFORMATION_MESSAGE);
jblName=newJLabel("賬戶姓名:
“+account.getName());
jblMsg.setText(,z余額:
“+account.getBalanceO);
)
)
);
〃給取款按鈕注冊(cè)監(jiān)聽器
jbWithdraw.addActionListener(
newActionListener(){
publicvoid
actionPerformed(ActionEventargO){
Strings=
JOptionPane.showInputDialog(”請(qǐng)輸入取款金
額:”);
double
money二Double.parseDouble((s.equals("")?〃0
”:s));
bank,withdraw(account,money);
/*JOptionPane.showMessageDialog(nu11,“
取款成功?。?!〃,〃信息提示〃,
JOptionPane.INFORMATION_MESSAGE);*/
jblName=newJLabel(“賬戶姓名:
/z+account.getName());
jblMsg.setText(,z余額:
“+account.getBalanceO);
)
)
);
〃給轉(zhuǎn)賬按鈕注冊(cè)監(jiān)聽器
jbTransfer.addActionListener(
newActionListener(){
publicvoid
actionPerformed(ActionEvente){
Stringsld
JOptionPane.showInputDialog(“請(qǐng)輸入要轉(zhuǎn)賬
的卡號(hào):〃);
longid2=Long.parseLong(sId);
Accountaccount2=
bank.verifyAccount(id2);
if(account2!=null)
(
StringsNum=
JOptionPane.showInputDialog(“請(qǐng)輸入您要轉(zhuǎn)
入賬戶的金額:〃);
double
money=Double.parseDouble((sNum.equals("")
?"0":sNum));
if(money<=account,balance)
(
bank,transferAccount(account,account2,
money);
JOptionPane.showMessageDialog(null,“轉(zhuǎn)
賬成功?。?!〃,”信息提示〃,
JOptionPane.INFORMATION_MESSAGE);
)
else
(
JOptionPane.showMessageDialog(null,“抱
歉,您賬戶沒有足夠的金額!請(qǐng)查看后重新選擇
輸入!”,
〃信息提示
〃,JOptionPane.ERROR_MESSAGE);
else
JOptionPane.showMessageDialog(null,“抱
歉,沒有找到您要轉(zhuǎn)入的賬戶信息!請(qǐng)核對(duì)后重
新選擇輸入!〃,〃信息提示〃,
JOptionPane.ERROR_MESSAGE);
jblName=newJLabel("賬戶姓名:
〃+account.getName());
jblMsg.setText(,z余額:
“+account.getBalanceO);
)
)
);
〃給退卡按鈕注冊(cè)監(jiān)聽器
jbCancel.addActionListener(
newActionListener0{
publicvoid
action
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 山核桃承包協(xié)議書
- 展廳展示合同范本
- 賓館預(yù)訂合同范本
- 潁上網(wǎng)簽合同范本
- 裝飾訂購合同范本
- 英文修理協(xié)議書
- 影視節(jié)目協(xié)議書
- 內(nèi)墻抹灰合同協(xié)議
- 兼職薪酬合同范本
- 幼兒活動(dòng)協(xié)議書
- PC-ABS合金阻燃改性:材料、方法與性能優(yōu)化研究
- GB/T 34110-2025信息與文獻(xiàn)文件(檔案)管理核心概念與術(shù)語
- 大連市社區(qū)工作者管理辦法
- 2025年河北地質(zhì)大學(xué)公開招聘工作人員48名筆試模擬試題及答案解析
- 火災(zāi)探測(cè)器的安裝課件
- 酒店轉(zhuǎn)讓合同協(xié)議書范本大全
- DB21∕T 3722.3-2023 高標(biāo)準(zhǔn)農(nóng)田建設(shè)指南 第3部分:項(xiàng)目預(yù)算定額
- 壓力管道質(zhì)量保證體系培訓(xùn)
- 2025年度數(shù)據(jù)中心基礎(chǔ)設(shè)施建設(shè)及運(yùn)維服務(wù)合同范本3篇
- 【八年級(jí)上冊(cè)地理】一課一練2.2 世界的氣候類型 同步練習(xí)
- 筋膜刀的臨床應(yīng)用
評(píng)論
0/150
提交評(píng)論