欢迎来到天天文库
浏览记录
ID:14101427
大小:47.50 KB
页数:17页
时间:2018-07-26
《java编写的模拟atm取款机程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Java编写的模拟ATM取款机程序客户端负责常见的取款机操作。(1)客户端需要登陆,用户输入正确的银行卡号和密码,系统核对无误后才能进行操作;(2)登陆后,用户可以进行查询余额、取款、存款和修改密码的操作;(3)修改密码时,用户需输入两次新密码,确定无误后方可更改;(4)取款和存款操作,有操作结果提示,如“操作成功”或“余额不足,操作失败”等。4.界面尽可能模仿自动取款机的实际界面。5.对于失败操作,尽可能采用异常捕捉的机制来完成。==================================================================Java编写的模拟ATM取
2、款机程序/***@version1.0*@authorDevil_Angel*该程序的功能为实现模拟银行ATM自动取款机提款,查询等功能.**/importjava.io.*;/*该类为实现客户信息及部分功能*/classAccount{privateStringcode=null;//信用卡号privateStringname=null;//客户姓名privateStringpassword=null;//客户密码privatedoublemoney=0.0;//卡里金额/********************/publicAccount(Stringcode,Stringname,
3、Stringpassword,doublemoney){this.code=code;this.name=name;this.password=password;this.money=money;}protectedStringget_Code(){returncode;}protectedStringget_Name(){returnname;}protectedStringget_Password(){returnpassword;}publicdoubleget_Money(){returnmoney;}/*得到剩余的钱的数目*/protectedvoidset_Balance(d
4、oublemon){money-=mon;}}/**********实现具体取款机功能*********/classATM{Accountact;//privateStringname;//privateStringpwd;publicATM(){act=newAccount("000000","Devil","123456",50000);}/***********欢迎界面***********/protectedvoidWelcome(){Stringstr="---------------------------------";System.out.print(str+""+"
5、欢迎使用Angel模拟自动取款机程序."+str+"");System.out.print("1.>取款."+""+"2.>查询信息."+""+"3.>密码设置."+""+"4.>退出系统."+"");}/**********登陆系统**********/protectedvoidLoad_Sys()throwsException{Stringcard,pwd;intcounter=0;BufferedReaderbr=newBufferedReader(newInputStreamReader(System.in));do{System.out.println(
6、"请输入您的信用卡号:");card=br.readLine();System.out.println("请输入您的密码:");pwd=br.readLine();if(!isRight(card,pwd)){System.out.println("您的卡号或密码输入有误.");counter++;}elseSysOpter();}while(counter<3);Lock_Sys();}/**********系统操作**********/protectedvoidSysOpter()throwsException{intnum;BufferedReaderbr=newBufferedR
7、eader(newInputStreamReader(System.in));System.out.println("请选择您要操作的项目(1-4):");num=br.read();//num为ASICC码转换的整数switch(num){case49:BetBalance();break;case50:Inqu_Info();break;case51:Set_Password();break;case52:Exit_Sys();
此文档下载收益归作者所有