第一次Java测试及感触(2018.9.20)

 在本周周四进行了java测试,有一点感触,测试的题目是用Java实现一个ATM机的管理系统。之前老师提前给我们样卷,结果考试的时候换了题型,瞬间脑子空白,一时不知道怎么下手,因为暑假虽然涉猎了java,但是没有深入系统地进行学习,导致了对很多知识一知半解,遇到很多问题束手无策。经过三个钟头的挣扎,只完成了一小部分的代码,只有简单的set()get()函数,以及简单的输出界面,能够输出ATM的初始界面,能够输入银行卡号,数据库也只是建立了一个大概。

后来在课后又对代码进行了断断续续的修改,对从网上找来的数据库代码段进行了较大修改,然后简单的补了其他部分的程序。

通过这次测试,我明白了初学者离熟练编写代码还有一段很长的距离,基本数据类型、数组、程序控制语句等都得在练习中熟悉,在之后的几天内,得知有人已经编出了图形窗口界面(为了简便起见我并没有往这方面想),便突然有了斗志,成长路上有这样全心向前的战友相信对我的正面帮助会很大。

以后每天要抽出时间进行代码习题的练习,熟能生巧,同时也要多读相关书籍,争取能在期末考试得到自己想要的结果。

account类

package zuoye;

//信1705-3 20173526 赵剑峰

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import java.io.IOException;
import java.io.Serializable;
import java.util.Scanner;
import java.util.ArrayList;
 
public class Account implements Serializable
{
private String accountID;//账户
private String accountname;//姓名
private String operatedate;//时间
private int operatetype;//操作类型
private String accountpassword;//密码
private int accountbalance;//余额
private int amount;//流水金额
public String getaccountID()
{
return accountID;
}
public String getaccountname()
{
return accountname;
}
public String getoperatedate()
{
return operatedate;
}
public int getoperatetype()
{
return operatetype;
}
public String getaccountpassword()
{
return accountpassword;
}
public int getaccountbalance()
{
return accountbalance;
}
public int getamount()
{
return amount;
}
public void setaccountID(String accountID)
{
this.accountID=accountID;
}
public void setaccountname(String accountname)
{
this.accountname=accountname;
}
public void setoperatedate(String operatedate)
{
this.operatedate=operatedate;
}
public void setoperatetype(int operatetype)
{
this.operatetype=operatetype;
}
public void setaccountpassword(String accountpassword)
{
this.accountpassword=accountpassword;
}
public void setaccountbalance(int accountbalance)
{
this.accountbalance=accountbalance;
}
public void setamount(int amount)
{
this.amount=amount;
}
public Account(String accountID,String accountname,String operatedate,int operatetype,String accountpassword,int accountbalance,int amount)
{
this.accountID=accountID;
this.accountname=accountname;
this.operatedate=operatedate;
this.operatetype=operatetype;
this.accountpassword=accountpassword;
this.accountbalance=accountbalance;
this.amount=amount;
}
public Account(){}
public String tostring() {
return "id="+accountID+",accountname="+accountname+",accountpassword="+accountpassword+",accountbalance="+accountbalance;
}
public String tostring1() {
return "id="+accountID+",accountname="+accountname+",operatedate="+operatedate+",operatetype="+operatetype+",aamount="+amount;
}
public static void main(String[] args) throws IOException
{
AccountManager a=new AccountManager();
ArrayList<Account> people=new ArrayList<Account>();
ArrayList<Account> list=new ArrayList<Account>();
 
a.show(people);
a.enterID(people,list);
}
}

 AccountManager类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Date;
public class AccountManager {
public void addAccount(ArrayList<Account> people)
{
Scanner in = new Scanner(System.in);
Account ac=new Account();
System.out.println("请输入账户的账号、名称、密码、账户余额");
String accountID=in.next();
String accountname=in.next();
String accountpassword=in.next();
int accountbalance=in.nextInt();
ac.setaccountID(accountID);
ac.setaccountname(accountname);
ac.setaccountpassword(accountpassword);
ac.setaccountbalance(accountbalance);
people.add(ac);
File file = new File("accountinformation.txt");
// 对象输出流
ObjectOutputStream out = null;
try {
// 将数组对象写入文件
out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(people);
out.flush();
out.close();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public void show(ArrayList<Account> people)
{
File file = new File("accountinformation.txt");
ObjectInputStream in = null;
try {
in = new ObjectInputStream(new FileInputStream(file));
people = (ArrayList<Account>) in.readObject();
for (int i=0;i<people.size();i++) {
Account s=people.get(i);
System.out.println(s.tostring());
}
 
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public void enterID(ArrayList<Account> people,ArrayList<Account> list)
{
int a=1;
int flag=-1;
while(a==1) {
System.out.println("**************************************************");
System.out.println(" 欢迎使用中国工商银行自动柜员系统");
System.out.println("请输入您的账号:");
Scanner in = new Scanner(System.in);
String ID=in.next();
if(ID.length()!=8)
{
System.out.println("该卡不是工行卡");
a=1;
}
File file = new File("accountinformation.txt");
ObjectInputStream oin = null;
try {
oin = new ObjectInputStream(new FileInputStream(file));
people = (ArrayList<Account>) oin.readObject();
for (int i=0;i<people.size();i++) {
Account s=people.get(i);
if(s.getaccountID().equals(ID))
{
flag=i;a=1;
}
}
if(flag==-1)
{
System.out.println("该账号不存在");
}
else
{
a=2;
}
 
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
enterpassword(people,flag,list);
}
public void enterpassword(ArrayList<Account> people,int i,ArrayList<Account> list)
{
System.out.println("**************************************************");
System.out.println(" 欢迎使用中国工商银行自动柜员系统");
System.out.println("请输入您的密码:");
Account s=new Account();
File file = new File("accountinformation.txt");
ObjectInputStream oin = null;
try {
oin = new ObjectInputStream(new FileInputStream(file));
people = (ArrayList<Account>) oin.readObject();
s=people.get(i);
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
for(int j=0;j<3;j++)
{
Scanner in = new Scanner(System.in);
String password=in.next();
if(s.getaccountpassword().equals(password))
{
enter(s.getaccountID(),people,list);
}
else
System.out.println("密码录入错误");
}
System.out.println("该账号三次录入密码错误,该卡已被系统没收,请与工行及时联系处理");
}
public void enter(String a,ArrayList<Account> people,ArrayList<Account> list)
{
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"使用中国工商银行自助柜员系统");
System.out.println("1、存款;");
System.out.println("2、取款;");
System.out.println("3、转账汇款;");
System.out.println("4、修改密码;");
System.out.println("5、查询余额;");
System.out.println("请输入选择:");
Scanner in = new Scanner(System.in);
int operatetype=in.nextInt();
switch(operatetype) {
case 1:deposit(a,people,list);break;
case 2:withdrawal(a,people,list);break;
case 3:transfer(a,people,list);break;
case 4:alter(a,people,list);break;
case 5:seclect(a,people,list);break;
}
}
public void deposit(String a,ArrayList<Account> people,ArrayList<Account> list)
{
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("请输入存款金额:");
Scanner in = new Scanner(System.in);
String money=in.next();
int flag=0;
if(money=="q")
{
enterID(people,list);
}
int num=Integer.valueOf(money);
File file = new File("accountinformation.txt");
ObjectInputStream oin = null;
try {
oin = new ObjectInputStream(new FileInputStream(file));
people = (ArrayList<Account>) oin.readObject();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Account ac=new Account();
for(int i=0;i<people.size();i++)
{
ac=people.get(i);
if(ac.getaccountID().equals(a))
{
flag=i;
break;
}
}
ac.setaccountbalance(ac.getaccountbalance()+num);
people.set(flag,ac);
System.out.println("当前账户存款操作成功。");
System.out.println("当前账户余额为:"+ac.getaccountbalance());
int operatetype=1;
ac.setoperatetype(operatetype);
ac.setamount(num);
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateNowStr = sdf.format(date);
ac.setoperatedate(dateNowStr);
list.add(ac);
File file1 = new File("accountlist.txt");
// 对象输出流
ObjectOutputStream out = null;
ObjectOutputStream out1 = null;
try {
out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(people);
out.flush();
out.close();
// 将数组对象写入文件
out1 = new ObjectOutputStream(new FileOutputStream(file1));
out1.writeObject(list);
out1.flush();
out1.close();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("1、返回输入账户界面");
System.out.println("2、返回操作界面");
int i=in.nextInt();
switch(i)
{
case 1:enterID(people,list);break;
case 2:enter(a,people,list);break;
}
}
public void withdrawal(String a,ArrayList<Account> people,ArrayList<Account> list)
{
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println(" 当前账户每日可以支取2万元。");
System.out.println(" 1、100元");
System.out.println(" 2、500元");
System.out.println(" 3、1000元");
System.out.println(" 4、1500元");
System.out.println(" 5、2000元");
System.out.println(" 6、5000元");
System.out.println(" 7、其他金额");
System.out.println(" 8、退卡");
System.out.println(" 9、返回");
Scanner in = new Scanner(System.in);
int x=in.nextInt();
int flag = 0;
int money = 0;
switch(x)
{
case 1:money=100;break;
case 2:money=500;break;
case 3:money=1000;break;
case 4:money=1500;break;
case 5:money=2000;break;
case 6:money=5000;break;
case 8:enterID(people,list);break;
case 9:enter(a,people,list);break;
}
if(x==7)
{
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("******************************************************");
System.out.println("请输入取款金额:");
money=in.nextInt();
}
File file = new File("accountinformation.txt");
ObjectInputStream oin = null;
try {
oin = new ObjectInputStream(new FileInputStream(file));
people = (ArrayList<Account>) oin.readObject();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Account ac=new Account();
for(int i=0;i<people.size();i++)
{
ac=people.get(i);
if(ac.getaccountID().equals(a))
{
flag=i;
break;
}
}
if(ac.getaccountbalance()<money)
{
System.out.println("账户余额不足");
}
else
{
ac.setaccountbalance(ac.getaccountbalance()-money);
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("当前账户取款操作"+money+"元成功。");
System.out.println("当前账户余额为:"+ac.getaccountbalance()+"元成功。");
}
int operatetype=2;
ac.setoperatetype(operatetype);
ac.setamount(money);
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateNowStr = sdf.format(date);
ac.setoperatedate(dateNowStr);
list.add(ac);
people.set(flag, ac);
File file1 = new File("accountlist.txt");
ObjectOutputStream out = null;
ObjectOutputStream out1 = null;
try {
out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(people);
out.flush();
out.close();
// 将数组对象写入文件
out1 = new ObjectOutputStream(new FileOutputStream(file1));
out1.writeObject(list);
out1.flush();
out1.close();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("1、返回输入账户界面");
System.out.println("2、返回操作界面");
int i=in.nextInt();
switch(i)
{
case 1:enterID(people,list);break;
case 2:enter(a,people,list);break;
}
}
public void transfer(String a,ArrayList<Account> people,ArrayList<Account> list)
{
int flag=0;
int money=0;
Account ab=new Account();
Scanner in = new Scanner(System.in);
File file = new File("accountinformation.txt");
ObjectInputStream oin = null;
try {
oin = new ObjectInputStream(new FileInputStream(file));
people = (ArrayList<Account>) oin.readObject();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Account ac=new Account();
for(int i=0;i<people.size();i++)
{
ac=people.get(i);
if(ac.getaccountID().equals(a))
{
flag=i;
break;
}
 
}
int num=0;
int leap=-1;
while(num==0)
{
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("******************************************************");
System.out.println("请输入转账账户:");
String b=in.next();
for(int i=0;i<people.size();i++)
{
int j=0;
ab=people.get(i);
if(ab.getaccountID().equals(b))
{
leap=i;
num=1;
break;
}
else
{
num=0;
}
}
if(num==0)
{
System.out.println("该账户不存在");
}
if(num==1)
{
int num2=0;
while(num2==0)
{
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("******************************************************");
System.out.println("请输入转账金额:");
money=in.nextInt();
if(ac.getaccountbalance()<money)
{
System.out.println("户余额不足");
System.out.println("您当前的余额为"+ac.getaccountbalance()+"元");
}
if(ac.getaccountbalance()>=money)
{
num2=1;
}
}
String name=ab.getaccountname();
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("******************************************************");
System.out.println("请确认是否向"+name+"转账"+money+"元");
System.out.println("确认请按Y,否请按N");
String x=in.next();
if(x.equals("X"))
{
enter(a,people,list);
}
if(x.equals("Y"))
{
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("******************************************************");
System.out.println("成功向"+name+"转账"+money+"元");
ac.setaccountbalance(ac.getaccountbalance()-money);
ab.setaccountbalance(ab.getaccountbalance()+money);
System.out.println("当前账户余额为:"+ac.getaccountbalance());
num=1;
}
}
}
people.set(flag, ac);
people.set(leap, ab);
int operatetype=3;
ac.setoperatetype(operatetype);
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateNowStr = sdf.format(date);
ac.setoperatedate(dateNowStr);
ac.setamount(money);
list.add(ac);
File file1 = new File("accountlist.txt");
ObjectOutputStream out = null;
ObjectOutputStream out1 = null;
try {
out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(people);
out.flush();
out.close();
// 将数组对象写入文件
out1 = new ObjectOutputStream(new FileOutputStream(file1));
out1.writeObject(list);
out1.flush();
out1.close();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("1、返回输入账户界面");
System.out.println("2、返回操作界面");
int i=in.nextInt();
switch(i)
{
case 1:enterID(people,list);break;
case 2:enter(a,people,list);break;
}
}
public void alter(String a,ArrayList<Account> people,ArrayList<Account> list)
{
int flag=0;
Scanner in = new Scanner(System.in);
File file = new File("accountinformation.txt");
ObjectInputStream oin = null;
try {
oin = new ObjectInputStream(new FileInputStream(file));
people = (ArrayList<Account>) oin.readObject();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Account ac=new Account();
for(int i=0;i<people.size();i++)
{
ac=people.get(i);
if(ac.getaccountID().equals(a))
{
flag=i;
break;
}
 
}
int num=0;
while(num==0)
{
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println(" 请输入当前密码:");
String pass=in.next();
if(ac.getaccountpassword().equals(pass))
{
num=1;
}
if(num==0)
System.out.println(" 当前密码录入错误");
if(num==1)
{
System.out.println(" 请输入修改密码:");
String n1=in.next();
System.out.println(" 请输入确认密码:");
String n2=in.next();
if(n1.equals(n2))
{
num=1;
ac.setaccountpassword(n1);
}
else
{
num=0;
System.out.println(" 修改密码与确认密码不一致");
}
}
}
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("当前账户密码修改成功");
people.set(flag, ac);
/*int operatetype=4;
ac.setoperatetype(operatetype);
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateNowStr = sdf.format(date);
ac.setoperatedate(dateNowStr);
list.add(ac);*/
File file1 = new File("accountlist.txt");
ObjectOutputStream out = null;
ObjectOutputStream out1 = null;
try {
out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(people);
out.flush();
out.close();
// 将数组对象写入文件
out1 = new ObjectOutputStream(new FileOutputStream(file1));
out1.writeObject(list);
out1.flush();
out1.close();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("1、返回输入账户界面");
System.out.println("2、返回操作界面");
int i=in.nextInt();
switch(i)
{
case 1:enterID(people,list);break;
case 2:enter(a,people,list);break;
}
}
public void seclect(String a,ArrayList<Account> people,ArrayList<Account> list)
{
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("******************************************************");
Scanner in = new Scanner(System.in);
File file = new File("accountinformation.txt");
ObjectInputStream oin = null;
try {
oin = new ObjectInputStream(new FileInputStream(file));
people = (ArrayList<Account>) oin.readObject();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Account ac=new Account();
for(int i=0;i<people.size();i++)
{
ac=people.get(i);
if(ac.getaccountID().equals(a))
{
break;
}
 
}
System.out.println("当前账户余额为:"+ac.getaccountbalance()+"元");
System.out.println("账户清单信息为:");
File file1 = new File("accountlist.txt");
ObjectInputStream oon = null;
try {
oon = new ObjectInputStream(new FileInputStream(file1));
list = (ArrayList<Account>) oon.readObject();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Account ab=new Account();
for(int i=0;i<list.size();i++)
{
ab=list.get(i);
if(ab.getaccountID().equals(a))
{
String op = null;
if(ab.getoperatetype()==1)
op="存款";
if(ab.getoperatetype()==2)
op="取款";
if(ab.getoperatetype()==3)
op="转账汇款";
System.out.println(""+ab.getoperatedate()+" "+op+" "+ab.getamount());
}
 
}
System.out.println("******************************************************");
System.out.println(" 欢迎"+a+"用户使用中国工商银行自助柜员系统");
System.out.println("1、返回输入账户界面");
System.out.println("2、返回操作界面");
int i=in.nextInt();
switch(i)
{
case 1:enterID(people,list);break;
case 2:enter(a,people,list);break;
}
}
}

  

posted @   夜神风  阅读(187)  评论(1编辑  收藏  举报
编辑推荐:
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
阅读排行:
· 手把手教你在本地部署DeepSeek R1,搭建web-ui ,建议收藏!
· 新年开篇:在本地部署DeepSeek大模型实现联网增强的AI应用
· Janus Pro:DeepSeek 开源革新,多模态 AI 的未来
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(三):用.NET IoT库
· 【非技术】说说2024年我都干了些啥
点击右上角即可分享
微信分享提示