import java.util.Arrays;
import java.util.Scanner;
public class ATM {
static Account account = new Account();
static Bank bank = new Bank();
public static void main(String[] args) {
int i,type;
Login(account.getAccountId(),account.getPassword(),account.getBalance(),account.getType());
}
public static void Login(String accountId[],int password[],double balance[],int type[]){
Scanner scanner = new Scanner(System.in);
System.out.println("输入账号:");
String user = scanner.next();
for (int i=0;i<accountId.length;i++){
if (accountId[i].equals(user)){
login_pass(i,password[i],type[i]);
}
}
System.out.print("账号错误,请重新");
Login(accountId,password,balance,type);
}
public static void login_pass(int i,int password,int type) {
int pass = 0;
String new_pass = " ";
Scanner scanner = new Scanner(System.in);
while(true){
System.out.println("输入密码: ");
new_pass = scanner.next();
try{
pass =Integer.parseInt(new_pass);
}catch (NumberFormatException e){
System.out.print("密码请输入数字!");
System.out.print("请重新");
login_pass(i,password,type);
}
if(pass == password){
if(type == 1){
System.out.println("欢迎你管理员");
admin();
}else{
System.out.println("登录成功!");
user_ATM(i);
}
}
System.out.print("密码错误!!!");
System.out.print("请重新");
login_pass(i,password,type);
}
}
public static void admin(){
Scanner scanner = new Scanner(System.in);
int t = 0;
while(true){
System.out.println("请输入 1添加用户 2注销用户 3退出系统 4查询用户信息 5退出登录");
t = scanner.nextInt();
switch(t){
case 1:
add();
break;
case 2:
account.setAccountId(bank.Logout(account.getAccountId()));
break;
case 3:
System.exit(-1);
break;
case 4: