textview java_view.TextView.java

package view; import java.awt.List; import com.handson.common.SystemIn; import exception.BalanceNotEnoughException; import exception.LoginException; import exception.RegisterException; import biz.FileBank; import biz.IBank; import biz.Bank; import biz.ListBank; public class TextView { IBank bank; long thisid; public void tools(){ System.out.println("********欢迎********"); System.out.println("******注册请输入1*****"); System.out.println("******登录请输入2*****"); System.out.println("******退出请输入3*****"); int i=SystemIn.readInt(); if(i==1){ reg(); }else if(i==2){ login(); }else if(i==3){ System.exit(0); }else{ tools(); } } private void reg() { System.out.println("请输入姓名>"); String name=SystemIn.readString(); System.out.println("请输入personId>"); String personId=SystemIn.readString(); System.out.println("请输入类型>"); int type=SystemIn.readInt(); System.out.println("请输入密码>"); String password=SystemIn.readString(); System.out.println("请再输入密码>"); String password2=SystemIn.readString(); try{ long result=bank.reg(password, password2, name, personId, type); System.out.println(result+"注册成功:"); tools(); }catch(RegisterException e){ System.out.println(e.getMessage()); reg(); } } private void oper() { System.out.println("存款请输入1"); System.out.println("取款请输入2"); System.out.println("查询余额请输入3"); System.out.println("退出请输入4"); System.out.println("返回主菜单请输入5"); int num=SystemIn.readInt(); if(num==1){ System.out.println("请输入存款额度>"); double money=SystemIn.readDouble(); bank.deposit(thisid, money); oper(); }else if(num==2){ System.out.println("请输入取款额度>"); double money=SystemIn.readDouble(); try{ bank.withdraw(thisid, money); oper(); }catch(BalanceNotEnoughException e){ System.out.println(e.getMessage()); tools(); } }else if(num==3){ double balance=bank.selectBalance(thisid); System.out.print("余额为>"+balance); oper(); }else if(num==4){ System.exit(0); }else if(num==5){ tools(); }else{ System.out.println("输入有误!"); oper(); } } private void login() { System.out.println("请输入账号>"); long id=SystemIn.readInt(); System.out.println("请输入密码>"); String password=SystemIn.readString(); try{ long resule=bank.login(id, password); System.out.println("登陆成功!"); this.thisid=resule; oper(); }catch(LoginException e){ System.out.println(e.getMessage()); tools(); } } public TextView() { super(); } public TextView(Bank bank) { super(); this.bank = bank; } public TextView(FileBank bank) { super(); this.bank = bank; } public TextView(ListBank bank) { super(); this.bank = bank; } }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值