public class BankCustomerMethod {
BankUtils bkUtils = new BankUtils();
public void bankCustomerMethod(Customer [] customer) {
boolean isExit = true;
while(isExit) {
System.out.println("需要进行的操作:1.存钱 2.取钱 3.修改密码 4.查看个人信息 5.返回上一级");
int customerSelect = bkUtils.getReadInt();
switch (customerSelect) {
case 1:
System.out.println("存钱");
break;
case 2:
System.out.println("取钱");
break;
case 3:
System.out.println("修改密码");
break;
case 4:
System.out.println("查看个人信息");
break;
case 5:
System.out.println("返回上一级");
isExit = false;
break;
default:
System.out.println("系统操作错误!!!");
break;
}
}
}
public Customer sysCustomerDengLu(Customer [] customers) {
for(int x = 1 ; x <= 3 ; x++) {
System.out.println("请输入用户账号:");
String account = bkUtils.getReadString();
System.out.println("请输入用户密码:");
@SuppressWarnings("unused")
String psd = bkUtils.getReadString();
String verificatAccount = null;
String verificatPsd = null;
Customer customer = null ;
for(int j = 0 ; j < customers.length; j++) {
if(customers[j].getAccount().equals(account)) {
verificatAccount = customers[j].getAccount();
verificatPsd = customers[j].getPassword();
customer = customers[j];
break;
}
}
if(verificatAccount == null) {
System.out.println("该用户账号不存在!!!你还有"+(10-x)+"次机会!");
}else if(!verificatPsd.equals(psd)) {
System.out.println("用户密码错误!!!你还有"+(5-x)+"次机会!");
}else if(verificatAccount != null && verificatPsd != null) {
System.out.println("登陆成功");
return customer;
}
if((10-x) == 0) {
System.out.println("你已被冻结");
}
}
return null;
}
}