软件工程-银行储蓄管理系统源代码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

.word格式,,专业.专注.packagesrc.day01;publicclassACC{//父类,以下是共有属性和方法//卡号protectedstaticlongid;//名字protectedstaticStringname;//身份证protectedstaticStringpersonId;//电子邮件protectedstaticStringemail;//密码protectedstaticlongpassword;//余额protectedstaticdoublebalance;publicACC(){}publicACC(longid,Stringname,StringpersonId,Stringemail,longpassword,doublebalance){this.id=id;.word格式,,专业.专注.this.name=name;this.personId=personId;this.email=email;this.password=password;this.balance=balance;}//存款方法publicstaticvoiddeposit(doublemoney){balance+=money;System.out.println(存款成功,你存入的金额为:+money);}publiclonggetId(){returnid;}publicvoidsetId(longid){this.id=id;}publicStringgetName(){.word格式,,专业.专注.returnname;}publicvoidsetName(Stringname){this.name=name;}publicStringgetPersonId(){returnpersonId;}publicvoidsetPersonId(StringpersonId){this.personId=personId;}publicStringgetEmail(){returnemail;}publicvoidsetEmail(Stringemail){this.email=email;}.word格式,,专业.专注.publiclonggetPassword(){returnpassword;}publicvoidsetPassword(longpassword){this.password=password;}publicdoublegetBalance(){returnbalance;}publicvoidsetBalance(doublebalance){this.balance=balance;}}packagesrc.day01;importjava.util.*;.word格式,,专业.专注.publicclassBank{//先定义两个动态数组,其中ban用来存储借记卡数据,ba用来存储信用卡数据staticVectorban=newVector();staticVectorba=newVector();//i指借记卡卡号,每增加一个用户,i自增1//j指借记卡卡号,每增加一个用户,j自增1privatestaticlongi=110000000;privatestaticlongj=610000000;publicBank(){}//判断用户办理借记卡还是信用卡的相关业务publicstaticvoidjusty(intch){booleank=true;while(k){if(ch==1){System.out.println(你将要办理借记卡业务:);break;}elseif(ch==2){System.out.println(你将要办理信用卡业务:);.word格式,,专业.专注.break;}else{System.out.println(输入指令错误,请重新输入:);k=false;}}}//开户方法publicstaticvoidregister(intch){justy(ch);Scannerre=newScanner(System.in);System.out.println(请输入开户的用户名:);Stringna=re.next();longkey;//两次密码不同的话循环进行p:while(true){System.out.println(请输入密码:);longpa=re.nextLong();System.out.println(请再次输入密码:);longpa1=re.nextLong();if(pa==pa1){.word格式,,专业.专注.key=pa1;break;}else{System.out.println(两次不相同,请重新输入);continuep;}}System.out.println(请输入身份证号:);StringperId=re.next();System.out.println(请输入email地址:);Stringem=re.next();System.out.println(请输入开户金额:);doublebal=re.nextDouble();//存储和输出过程,将以上输入的正确数据存储到相应的数组中if(ch==1){DebitAccDe=newDebitAcc(i,na,perId,em,key,bal);ban.add(De);System.out.println(恭喜你开户成功:你的卡号为+i);.word格式,,专业.专注.i++;}elseif(ch==2){CreditAccCr=newCreditAcc(j,na,perId,em,key,bal);ba.add(Cr);System.out.println(恭喜你开户成功:你的卡号为+j);j++;}System.out.println(用户名:+na);System.out.println(身份证:+perId);System.out.println(email:+em);System.out.println(开户金额:+bal);}//用户子菜单.word格式,,专业.专注.publicstaticvoidMenuCu(){Scannersc=newScanner(System.in);while(true){System.out.println(欢迎使用银行系统);System.out.println(请输入指令:1、开户2、登陆3、退出到上级);intchoice=sc.nextInt();switch(choice){case1:openAccount();break;case2:logIn();break;case3:return;default:System.out.println(输入指令错误,请重新输入);break;}.word格式,,专业.专注.}}//开户方法总方法privatestaticvoidopenAccount(){System.out.println(你将要办理开户业务:);System.out.println(请输入你要选择的银行卡类型:1、借记卡2、信用卡);Scannerop=newScanner(System.in);intch=op.nextInt();register(ch);}//用户登陆总方法publicstaticvoidlogIn(){System.out.println(欢迎进入用户登陆界面,请选择你要登陆的卡号类型:1、借记卡2、信用卡);booleano=true;booleanp=false;.word格式,,专业.专注.Scannerlo=newScanner(System.in);intch=lo.nextInt();justy(ch);l:while(o){System.out.println(请输入你的卡号:);longuser=lo.nextLong();if(ch==1){//调用对应数组的卡号群与输入卡号匹配,以下同理for(inti=0;iBank.ban.size();i++){DebitAccd=(DebitAcc)Bank.ban.get(i);if(user==d.id){System.out.println(请输入密码:);longpassword=lo.nextLong();//对密码进行正误判断,正则p为true,可向下进行,false则直接返回输入卡号命令,即只有输密码一次机会p=pass(password);while(p){d.menu1();.word格式,,专业.专注.break;}}else{//卡号不存在进行的操作System.out.println(该卡号不存在,是否重新输入:1、继续2、返回上一级);intc=lo.nextInt();if(c==1){continuel;}else{return;}}}}else{for(intj=0;jBank.ba.size();j++){CreditAccc=(CreditAcc)Bank.ba.get(j);if(user==c.id){System.out.println(请输入密码:);longpassword=lo.nextLong();p=pass(password);.word格式,,专业.专注.while(p){c.menu1();break;}}else{System.out.println(该卡号不存在,请重新输入:);continuel;}}}}}//密码正误判断方法publicstaticbooleanpass(longpassword){if(password!=DebitAcc.password){System.out.println(密码错误!重新输入:);.word格式,,专业.专注.returnfalse;}else{returntrue;}}//管理员操作菜单publicstaticvoidmenuAd(){Scannermc=newScanner(System.in);while(true){System.out.println(欢迎使用银行系统);System.out.println(请输入指令:1、查看所有用户余额2、查看信用卡用户总信用额度3、退出到上级);intm=mc.nextInt();switch(m){case1:checkBalance();break;case2:checkCeiling();break;case3:.word格式,,专业.专注.return;default:System.out.println(输入错误,请重试:);break;}}}//营业员查询总余额publicstaticvoidcheckBalance(){doublek=0.0;for(inti=0;iBank.ban.size();i++){DebitAccd=(DebitAcc)Bank.ban.get(i);k+=d.balance;}for(intj=0;jBank.ba.size();j++){CreditAccc=(CreditAcc)Bank.ba.get(j);k+=c.balance;}System.out.println(本银行账户的总余额为:+k);}publicstaticvoidcheckCeiling(){doublek=0.0;.word格式,,专业.专注.for(intj=0;jBank.ba.size();j++){CreditAccc=(CreditAcc)Bank.ba.get(j);k+=c.ceiling;}System.out.println(本银行信用卡账户的总信用度为:+k);}//银行系统总菜单publicstaticvoidmenuWel(){Scannerb=newScanner(System.in);while(true){System.out.println(欢迎使用银行系统);System

1 / 25
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功