今天进行教材中综合实例的练习,要求实现简单的ATM机工作功能。首先对系统的功能进行分析,
然后确定要使用的流程结构及函数。
今天完成了部分要求,明天继续。
public class AccountManager {
Account ab=new Account();
Account[] ai=new Account[5];
public void zhaohaoboshuodefangfa() {
ai[0]=new Account("20193937","李兴宇","111222",0);
ai[1]=new Account("20193938","张三","222333",0);
ai[2]=new Account("20193939","李四","333444",0);
ai[3]=new Account("20193940","王五","444555",0);
ai[4]=new Account("20193941","刘一","555666",0);
}
public void zhanghao() {
//Account at1=new Account("null","null","null",)
while(true) {
for(int i=0;i<40;i++) {
System.out.print("*");
}
System.out.println();
System.out.println(" 欢迎使用中国工商银行自动柜员系统 ");
for(int i=0;i<40;i++) {
System.out.print("*");
}
System.out.println();
Scanner sc=new Scanner(System.in);
System.out.println("请输入您的帐号:");
String id=sc.nextLine();
if(id.length()!=8) {
System.out.println("该卡不是工行卡");
continue;
}
int i;
int index=-1;
for(i=0;i<ai.length;i++) {
if(ai[i].getAccountID().equals(id)) {
index=i;
ab=ai[index];
}
}
if(index==-1&&id.length()==8) {
System.out.println("该账号不存在");
}if(index!=-1&&id.length()==8) {
AccountManager acc=new AccountManager();
acc.mima();
}
}
}