欢迎来到天天文库
浏览记录
ID:32570727
大小:76.30 KB
页数:4页
时间:2019-02-12
《简单银行系统java版》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、packageexperiment;importjava.util.Scanner;publicclassBank{publicintusercount;publicBankUseruser;publicvoidusershowup(BankUseruser){//显示银行账户的详细信息System.out.println("下面是"+user.username+"的详细信息");System.out.print("用户账户:"+user.banknumber);System.out.print("用户名所在银行:"
2、+user.bankname);System.out.print("用户名地址:"+user.useraddress);System.out.print("用户名余额:"+user.leftmoney);}/*publicvoidadduser(BankUserBankUser){下面是添加用户,方法voidadduser(BankUser)}/***@paramargs*/publicBankUserusersum[]=newBankUser[1000];publicvoidadduser(BankUseruser
3、){//把用户汇总usercount++;usersum[usercount-1]=user;}publicvoiduser(){//创建新用户Scanners=newScanner(System.in);System.out.println("请输入银行名:");Stringstr1=s.nextLine();System.out.println("请输入用户名:");Stringstr2=s.nextLine();System.out.println("请输入用户地址:");Stringstr3=s.nextLi
4、ne();System.out.println("请输入用户账号:");intstr4=s.nextInt();System.out.println("请输入用户金额:");Doublestr5=s.nextDouble();BankUseruser=newBankUser(str2,str1,str3,str4,str5);adduser(user);System.out.println("是否继续添加用户"+"是,请输入yes");Stringstr=s.next();if(str.equals("yes")){
5、user();}}publicvoidSelect(BankUseruser){//用户能选择的功能System.out.println("请选择你想要的功能:");System.out.print("查询余额请输入:1"+"取款请输入:2"+"存款请输入3查询你的账户详细信息请输入4");Scannersc=newScanner(System.in);intn=sc.nextInt();switch(n){case1:System.out.println("账户余额:"+user.getleftmoney());b
6、reak;case2:{System.out.print("请输入你需要取走的金额");doublem=sc.nextDouble();user.getmoney(m);}break;case3:{System.out.println("请输入你存款金额");doublemoney=sc.nextDouble();user.savemoney(money);};break;case4:{usershowup(user);};break;}System.out.println("是否继续"+"是?,请输入yes");S
7、tringstr=sc.next();if(str.equals("yes")){Select(user);}}publicstaticvoidmain(String[]args){Bankbank=newBank();bank.user();System.out.print("请输入你查询的用户的账号:");Scanners1=newScanner(System.in);intnum=s1.nextInt();for(inti=0;i8、um[i].banknumber;if(num2==num){BankUseruserselect=bank.usersum[i];bank.Select(userselect);i++;}else{System.out.println("你输入的账号不存在");}}}}packageexperiment;importjava.util.Sca
8、um[i].banknumber;if(num2==num){BankUseruserselect=bank.usersum[i];bank.Select(userselect);i++;}else{System.out.println("你输入的账号不存在");}}}}packageexperiment;importjava.util.Sca
此文档下载收益归作者所有