ATM管理系统java窗口界面完整版Word格式文档下载.docx

上传人:b****2 文档编号:3803345 上传时间:2023-05-02 格式:DOCX 页数:31 大小:22.74KB
下载 相关 举报
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第1页
第1页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第2页
第2页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第3页
第3页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第4页
第4页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第5页
第5页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第6页
第6页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第7页
第7页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第8页
第8页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第9页
第9页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第10页
第10页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第11页
第11页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第12页
第12页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第13页
第13页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第14页
第14页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第15页
第15页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第16页
第16页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第17页
第17页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第18页
第18页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第19页
第19页 / 共31页
ATM管理系统java窗口界面完整版Word格式文档下载.docx_第20页
第20页 / 共31页
亲,该文档总共31页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

ATM管理系统java窗口界面完整版Word格式文档下载.docx

《ATM管理系统java窗口界面完整版Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《ATM管理系统java窗口界面完整版Word格式文档下载.docx(31页珍藏版)》请在冰点文库上搜索。

ATM管理系统java窗口界面完整版Word格式文档下载.docx

7、运行时界面简示

1.初始界面(账户登录)

 

1、查询:

注意事项:

1、本系统采用的编程环境是JDK1.7,jer7。

因此,运行代码需

要保持电脑上所装的JDK为1.7以上版本,如有报错,只需换个

高一点的版本即可。

注意:

第一次装JDK要配置环境变量(请

查阅相关资料,比较简单)

2、本系统代码涉及到包,因此如果报名不一致就会报错,解

决方法:

修改一下包名即可

3、建议把各个类写在同一个包下面,且每一个类单独写一个

java文件,如下图:

占Java-EAhW7/src/com/qx/ATMlMlainFrarejava-EclioseSDK

-ileEditSourceRefactcrNavigateSearchProjectRunWindowHelp

▼3前■▼Q▼4■彭斗;

&

■击4•-骨巨归.匣喑上|,*•W\

EPdckogcExplorer招°

3

也ATMLcginFroncj-svj]£

]AlMMnfrftmcjavo皿ATMOpcnAct

EJAM02

EiAMDJ

BAM04

RWS

BAM网

BAM07

:

Fcom.qx

jj]Accountjiva

J]ATMLcginFrdiiTiejdVd』AIMMain^rame.java.JATMOpciiiAccouiniFrffr,J]Bflnkjaiva

2)CfeditAccountjavc

SavingAtecunt,java

JRESystemLibrary7]日^ccountw

jblKame=newJLatJblMsg<

setrext(r}

//绐取款按钮注册监听器

jtoWitfidraw,aadActionListenainewActionListener(){

publicvoidaction兴Strings-JOptidoublemoney=DoLbank,withdraw(ac/*JCptionPanc.sFJopticJLatjbltisg.sctrcxt(e

4、在运行程序前,需要在项目下面新建一个account.txt

(用来保存数据)文件(如上图),并在其中写入至少一个账户

信息,(如下图,其中每项代表的意思,请读者参照代码内的注

释),否则在初始化的时候会因为找不到账户信息,从而产生异常。

系统源码:

Account类

packagecom.qx;

importjavax.swing.JOptionPane;

/***账户类:

包含两种账户类型-->

1.储蓄账户2.信用账户*/publicabstractclassAccount{

//属性protectedlongid;

protectedStringpassword;

protectedStringname;

protectedStringpersonId;

protectedStringaccountType;

protecteddoublebalance;

//构造方法

publicAccount()(

super();

}

publicAccount(longid,Stringpassword,Stringname,StringpersonId,

Stringtype,doublebalance)(

this.id=id;

this.password=password;

this.name=name;

this.personId=personId;

this.accountType=type;

this.balance=balance;

//getXxx,setXxx方法

publiclonggetId()(

returnid;

publicvoidsetId(longid)(

publicStringgetPassword()(

returnpassword;

publicvoidsetPassword(Stringpassword)(this.password=password;

publicStringgetName()(

returnname;

publicvoidsetName(Stringname)(this.name=name;

publicStringgetPersonId()(

returnpersonId;

publicvoidsetPersonId(StringpersonId)(this.personId=personId;

publicStringgetAccountType()(

returnaccountType;

publicvoidsetAccountType(StringaccountType)(

this.accountType=accountType;

publicdoublegetBalance()(

returnbalance;

publicvoidsetBalance(doublebalance)(

/**

*存款

*/publicvoiddeposit(doublemoney)(

balance+=money;

*取款(取款方式由账户类型决定,因此设为抽象方法,相

应的Account类应设为抽象类)

*/publicabstractvoidwithdraw(doublemoney);

SavingAccount类packagecom.qx;

*储蓄账户类

*/

publicclassSavingAccountextendsAccount{

//构造函数

publicSavingAccount(){

publicSavingAccount(longid,Stringpassword,Stringname,

StringpersonId,StringaccountType,doublebalance){

super(id,password,name,personId,accountType,balance);

//对父类的withdraw()实现

publicvoidwithdraw(doublemoney)(

if(balance<

money)(

/*System.out.println("

对不起,账户余额不足!

"

);

JOptionPane.showMessageDialog(null,”对不起,

账户余额不足!

信息提示

”,JOptionPane.ERROR_MESSAGE);

else

balance-=money;

CresitAccount类

*信用账户类,增加一个信用额度ceiling属性*/publicclassCreditAccountextendsAccount{

privateintceiling;

//构造函数publicCreditAccount(){

publicCreditAccount(longid,Stringpassword,Stringname,

StringpersonId,StringaccountType,double

balance,intceiling){

super(id,password,name,personId,accountType,

balance);

this.ceiling=ceiling;

publicintgetCeiling(){

returnceiling;

publicvoidsetCeiling(intceiling)(

//实现父类的withdraw。

if((balance+ceiling)<

对不起,已超出您的信用

额度!

JOptionPane.showMessageDialog(null,”对不起,

已超出您的信用额度!

信息提示

Bank类

importjava.io.BufferedReader;

importjava.io.BufferedWriter;

importjava.io.File;

importjava.io.FileNotFoundException;

importjava.io.FileReader;

importjava.io.FileWriter;

importjava.io.IOException;

importjava.util.ArrayList;

importjava.util.Iterator;

importjava.util.List;

importjava.util.Properties;

/***Bank类

*编写Bank类,属性:

1.当前所有的账户对象的集合,存放在数组中

2.当前账户数量

方法:

1.用户开户,需要的参数:

id,密码,密码确认,姓名,身份证号码,账户类

型,返回新创立的Account对象的账号,

提示:

用s1.equals(s2)能够比较s1,s2两个字符串的值是否相等.

账户类型是一个整数,为0的时候表示储蓄账户,为1的时候表示信

用账户

2.用户登录,参数:

id,密码返回登录账户的账号

3.用户存款,参数:

id,存款数额,返回void

4.用户取款,参数:

id,取款数额,返回void

5.查询余额,参数:

id,返回该账户的余额double

用户会经过调用Bank对象以上的方法来操作白己的账户,请分析

各个方法需要的参数

publicclassBank{

/*privateAccount[]accounts=newAccount[20];

privateListaccountsList;

privateintnumber;

//账户数目

privateintid=1001;

//确定银行账号从1001开始生成,即第

一个账户的账号是1001

publicBank()(

accountsList=newArrayList<

Account>

();

number=0;

BufferedReaderbufReader=null;

Propertiesprops=System.getProperties();

Stringpath=props.getProperty("

user.dir"

try{

bufReader=newBufferedReader(new

FileReader(newFile(path,"

account.txt"

)));

Strings=bufReader.readLine();

while(s!

=null){

String[]str=s.split("

"

if(str[4].equals("

0”))

{

AccountsavingAcc=new

SavingAccount(Long.parseLong(str[0]),

str[1].toString(),

str[2].toString(),

str[3].toString(),str[4].toString(),

Double.parseDouble(str[5]));

accountsList.add(savingAcc);

AccountcreditAcc=new

CreditAccount(Long.parseLong(str[0]),

Double.parseDouble(str[5]),5000);

accountsList.add(creditAcc);

number++;

id++;

s=bufReader.readLine();

}catch(NumberFormatExceptione){

//TODOAuto-generatedcatchblocke.printStackTrace();

}catch(FileNotFoundExceptione){

}catch(IOExceptione){

}finally(

try(

if(bufReader!

=null)

bufReader.close();

}catch(IOExceptione)(

//TODOAuto-generatedcatchblock

e.printStackTrace();

//getXxx,setXxx

publicListgetAccounts()(

returnaccountsList;

publicvoidsetAccounts(Listaccounts)(this.accountsList=accounts;

publicintgetNumber()(

returnnumber;

publicvoidsetNumber(intnumber)(

this.number=number;

publicintgetId(){

publicvoidsetId(intid){

*开户

publicAccountopenAccount(Stringpasswdl,Stringpasswd2,

Stringname,

Stringpersonld,Stringtype){

//创立一个新账户

Accountaccount=null;

〃判断两次密码是否一致

if(passwd1.equals(passwd2)){

//若一致,再判断账户类型(根据type的值)

if(type.equals("

1"

))(

//可令开始余额为10,信用额度为5000

account=newCreditAccount(id,passwdl,name,personId,type,10,5000);

account=newSavingAccount(id,passwd1,name,personId,type,10);

//将账户存入账户集合accountsList中

accountsList.add(account);

JOptionPane.showMessageDialog(null,"

开户成

功!

信息提示"

JOptionPane.INFORMATION_MESSAGE);

JOptionPane.showMessageDialog(null,”您的卡号

为:

+id+"

\n"

+

您的密码为:

+passwd1+"

+"

您的户名为:

+name+"

您的身份证号为:

+personId+"

您的账户类型为:

+type+"

account.accountType=type;

number++;

returnaccount;

//此时开户成功

JOptionPane.showMessageDialog(null,”对不起!

您两次密码输入不匹配,开户失败!

"

returnnull;

//此时开户失败

*保存数据

publicvoidsaveAccountDate(){

BufferedWriterbufWriter=null;

Strings=null;

bufWriter=newBufferedWriter(newFileWriter(new

File(path,"

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

bufWriter.newLine();

bufWriter.flush();

//清空缓存中的内容

}finally{

if(bufWriter!

=null)(

bufWriter.close();

}catch(lOExceptione)(

*登录验证

publicAccountverifyAccount(longid,Stringpassword)(

Accountacc=null;

for(Iteratoriterator=accountsList.iterator();

(//若存在账户

acc=(Account)iterator.next();

if(acc!

=null)(

if(id==acc.getId()&

password.equals(acc.getPassword()))(account=acc;

break;

break;

*转账验证(方法的重载)

publicAccountverifyAccount(longid)(

if(id==acc.getId())(

account=acc;

/

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

当前位置:首页 > 初中教育 > 中考

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

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