package src.day01;public class ACC {//父类,以下是共有属性和方法//卡号protected static long id;// 名字protected static String name;// 身份证protected static String personId;//电子邮件protected static String email;// 密码protected static long password;//余额protected static double balance;public ACC(){}public ACC(long id,String name,String personId,String email,long password,double balance ){this.id = id; = name;this.personId = personId;this.email = email;this.password = password;this.balance = balance;}// 存款方法public static void deposit(double money){balance += money;System.out.println("存款成功,你存入的金额为:" + money); }public long getId() {return id;}public void setId(long id) {this.id = id;}public String getName() {return name;}public void setName(String name) { = name;}public String getPersonId() {return personId;}public void setPersonId(String personId) {this.personId = personId;}public String getEmail() {return email;}public void setEmail(String email) {this.email = email;}public long getPassword() {return password;}public void setPassword(long password) {this.password = password;}public double getBalance() {return balance;}public void setBalance(double balance) {this.balance = balance;}}package src.day01;import java.util.*;public class Bank {//先定义两个动态数组,其中ban用来存储借记卡数据,ba用来存储信用卡数据static Vector ban = new Vector();static Vector ba = new Vector();//i指借记卡卡号,每增加一个用户,i自增1//j指借记卡卡号,每增加一个用户,j自增1private static long i = 110000000;private static long j = 610000000;public Bank(){}//判断用户办理借记卡还是信用卡的相关业务public static void justy(int ch){boolean k = true ;while(k){if(ch ==1){System.out.println("你将要办理借记卡业务:");break;}else if(ch ==2){System.out.println("你将要办理信用卡业务:");break;}else{System.out.println("输入指令错误,请重新输入:");k=false;}}}//开户方法public static void register(int ch){justy(ch);Scanner re = new Scanner(System.in);System.out.println("请输入开户的用户名:");String na =re.next();long key;//两次密码不同的话循环进行p: while (true){System.out.println("请输入密码:");long pa = re.nextLong();System.out.println("请再次输入密码:");long pa1 = re.nextLong();if(pa==pa1 ){key = pa1;break ;}else{System.out.println("两次不相同,请重新输入");continue p;}}System.out.println("请输入身份证号:");String perId = re.next();System.out.println("请输入email地址:");String em = re.next();System.out.println("请输入开户金额:");double bal = re.nextDouble();//存储和输出过程,将以上输入的正确数据存储到相应的数组中 if(ch==1){ DebitAcc De = newDebitAcc(i,na,perId,em,key,bal);ban.add(De);System.out.println("恭喜你开户成功:你的卡号为" + i);i++;}else if(ch==2){CreditAcc Cr = new CreditAcc(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 );}//用户子菜单public static void MenuCu(){Scanner sc = new Scanner(System.in);while(true){System.out.println("欢迎使用银行系统");System.out.println("请输入指令:1、开户 2 、登陆 3、退出到上级");int choice = sc.nextInt();switch(choice){case 1:openAccount();break;case 2:logIn();break;case 3:return;default :System .out .println("输入指令错误,请重新输入");break;}}}//开户方法总方法private static void openAccount(){System.out.println("你将要办理开户业务:");System.out.println("请输入你要选择的银行卡类型: 1、借记卡 2、信用卡 ");Scanner op = new Scanner(System.in);int ch = op.nextInt();register(ch);}//用户登陆总方法public static void logIn( ){System.out.println("欢迎进入用户登陆界面,请选择你要登陆的卡号类型: 1、借记卡 2、信用卡" );boolean o = true;boolean p =false;Scanner lo = new Scanner(System.in);int ch = lo.nextInt();justy(ch);l: while(o) {System.out.println("请输入你的卡号:");long user = lo. nextLong();if(ch==1){//调用对应数组的卡号群与输入卡号匹配,以下同理 for(int i = 0;i<Bank.ban.size();i++){DebitAcc d = (DebitAcc)Bank.ban.get(i);if(user == d.id){System.out.println("请输入密码:");long password = lo.nextLong();//对密码进行正误判断,正则p为true,可向下进行,false则直接返回输入卡号命令,即只有输密码一次机会p = pass(password) ;while(p){d.menu1();break;}}else{//卡号不存在进行的操作System.out.println("该卡号不存在,是否重新输入:1、继续2、返回上一级");int c =lo.nextInt();if(c==1){continue l;}else{return;}}}}else {for(int j =0;j<Bank.ba.size();j++){CreditAcc c = (CreditAcc)Bank.ba.get(j);if(user==c.id){System.out.println("请输入密码:");long password = lo.nextLong();p = pass(password) ;while(p){c.menu1();break;}}else{System.out.println("该卡号不存在,请重新输入:");continue l;}}}}}//密码正误判断方法public static boolean pass( long password){if(password !=DebitAcc.password){System.out.println("密码错误!重新输入:");return false;}else{return true;}}//管理员操作菜单public static void menuAd(){Scanner mc = new Scanner(System.in);while(true){System.out.println("欢迎使用银行系统");System.out.println("请输入指令:1、查看所有用户余额 2 、查看信用卡用户总信用额度 3、退出到上级");int m =mc.nextInt();switch(m){case 1:checkBalance();break;case 2:checkCeiling();break;case 3:return;default:System.out.println("输入错误,请重试:");break;}}}//营业员查询总余额public static void checkBalance(){double k =0.0;for(int i = 0;i<Bank.ban.size();i++){DebitAcc d = (DebitAcc)Bank.ban.get(i);k += d.balance;}for(int j=0;j<Bank.ba.size();j++){CreditAcc c = (CreditAcc)Bank.ba.get(j);k+=c.balance;}System.out.println("本银行账户的总余额为:" + k);}public static void checkCeiling(){double k =0.0;for(int j=0;j<Bank.ba.size();j++){CreditAcc c = (CreditAcc)Bank.ba.get(j);k+=c.ceiling;}System.out.println("本银行信用卡账户的总信用度为:" + k);}//银行系统总菜单public static void menuWel(){Scanner b = new Scanner(System.in);while(true){System.out.println("欢迎使用银行系统");System.out.println("请输入指令:1、营业管理员 2、普通用户 3、退出");int ba =b.nextInt();switch(ba){case 1:menuAd();break;case 2:MenuCu();break;case 3:System .out .println("感谢你的使用,欢迎下次光临");System.exit(0);}}}}package src.day01;import java.util.*;public class CreditAcc extends ACC {//信用卡子类先定义信用额度为一常量public double ceiling = 500.0;CreditAcc(){super();}CreditAcc(long id,String name,String personId,String email,long password,double balance){super(id,name,personId,email,password,balance);}//取款方法public void withdraw(double money){if(money>balance){System.out.println("你的余额已不足,是否透支?1.透支2.不透支");Scanner cr = new Scanner (System.in);int c = cr.nextInt();switch(c){case 1:if(ceiling + balance<money){System.out.println("信用度不足,无法透支,请重新输入");}else{ceiling = (ceiling +balance)-money;balance = 0;}break;case 2:break;default:System.out.println("操作错误,请重新输入");break;}}}//查询方法public void show(){System.out.println("姓名:" +name +" 卡号:" + id);if(balance==0){System.out.println("你的余额为0,信用度为:" + ceiling);}else{System.out.println("你的余额为:" + balance);}}// 信用卡子菜单public static void menu1(){boolean b=true;while(b){System .out.println("请输入指令:1、取款2、存款3、查询4、退出到上级");Scanner men = new Scanner(System.in);int m =men.nextInt();switch(m){case 1:System.out.println("请输入取款金额:");double money = men.nextDouble();DebitAcc.withdraw(money);break;case 2:System.out.println("请输入存款金额:");double money1 = men.nextDouble();DebitAcc.deposit(money1);break;case 3:DebitAcc.show();break;case 4:return;}}}}package src.day01;import java.util.Scanner;public class DebitAcc extends ACC {//借记卡子类DebitAcc(){super();}DebitAcc(long id,String name,String personId,String email,long password,double ancbalancee){super(id,name,personId,email,password,ancbalancee) ;}//借记卡子菜单public static void menu1(){boolean b=true;while(b){System .out.println("请输入指令:1、取款2、存款3、查询4、退出到上级");Scanner men = new Scanner(System.in);int m =men.nextInt();switch(m){case 1:System.out.println("请输入取款金额:");double money = men.nextDouble();DebitAcc.withdraw(money);break;case 2:System.out.println("请输入存款金额:");double money1 = men.nextDouble();DebitAcc.deposit(money1);break;case 3:DebitAcc.show();break;case 4:return;}}}//取款方法,不可透支public static void withdraw(double money){if(money> balance){System.out.println("你的余额已不足,无法透支,请你重新输入:");return;}balance-=money;}//查询方法public static void show(){System.out.println("姓名:" +name +" 卡号:" + id);System.out.println("你的余额为:" + balance);}}package src.day01;public class Welbank {/*** @param args*/public static void main(String[] args) {// 银行系统主方法Bank bank = new Bank();bank. menuWel();}}。