-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
721 lines (655 loc) · 23.2 KB
/
Main.java
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
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.io.IOException;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.Scanner;
import java.util.InputMismatchException;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) throws IOException {
try
{
//we created sample arraylists with Users, Athletes, Coaches objects to another project in order to serialize them
//Now we start by deserialize them
//inputs arraylist with Users type objects from file UserInfo.ser
FileInputStream fis = new FileInputStream("UserInfo.ser");
ObjectInputStream ois = new ObjectInputStream(fis);
ArrayList<Users> usersarray = (ArrayList<Users>)ois.readObject();
ois.close();
fis.close();
//inputs arraylist with Athletes type objects from file AthleteInfo.ser
FileInputStream fisath = new FileInputStream("AthleteInfo.ser");
ObjectInputStream oisath = new ObjectInputStream(fisath);
ArrayList<Athletes> athletesearray = (ArrayList<Athletes>)oisath.readObject();
oisath.close();
fisath.close();
//inputs arraylist with Coaches type objects from file CoachInfo.ser
FileInputStream fiscoa = new FileInputStream("CoachInfo.ser");
ObjectInputStream oiscoa = new ObjectInputStream(fiscoa);
ArrayList<Coaches> coachesarray = (ArrayList<Coaches>)oiscoa.readObject();
oiscoa.close();
fiscoa.close();
boolean flaglg=false;
//the user choses to either register or log in
System.out.println("Do you want to register or log in?");
System.out.println("press 1 to register or 2 to log in");
int logorreg=7;
Scanner Obj = new Scanner(System.in);
do{
try{
logorreg = Obj.nextInt();
if (logorreg == 1 || logorreg==2){
break;
}
System.out.println("Invalid... Press 1 or 2");
}
catch (InputMismatchException e) {
System.out.println("Invalid... Press enter a number 1 or 2");
Obj.nextLine();
}
} while (logorreg != 1 && logorreg!=2);
if (logorreg==1){
boolean flag=true;
System.out.println("Enter username");
//the user enters a username
Scanner myObj = new Scanner(System.in);
String username1="a";
while (flag==true){
username1 = myObj.nextLine(); // Read user input
for (Users q : usersarray){
if (q.getUsername().equals(username1)){
flag=true;
System.out.println("This username already exists. Enter another username");
break;
} else{
flag= false;
}
}
}
System.out.println("Enter Password");
Scanner objpass = new Scanner(System.in);
//the user enters a password
String password = objpass.nextLine();
System.out.println("Are you an athlete or a coach?/n Write athlete for athlete or coach for coach");
String choice;
do{
Scanner objchoice = new Scanner(System.in);
//the user enters if they are an athlete or a coach
choice = objchoice.nextLine();
if (choice.equals("athlete") || choice.equals("coach")){
break;
}
System.out.println("Invalid... Write athlete or coach");
} while (choice!="athlete" && choice!="coach");
Users user = new Users(username1, password, choice) ;
usersarray.add(user);
Scanner input1 = new Scanner(System.in);
//for athletes
String usernameuser;
if (choice.equals("athlete")){
Athletes athlete = new Athletes(username1,password,choice);
athletesearray.add(athlete);
AthletesActions athleteact = new AthletesActions(athlete);
int i=1;
do {
System.out.println();
//the menu of the application for athletes
System.out.println("Type \n1 to edit your profile \n2 to view your profile \n3 to see a Chat \n4 to send a message \n5 to log out");
System.out.println();
Scanner sc = new Scanner(System.in);
boolean flag1;
boolean loop=false;
do{
try{
i = sc.nextInt();
if(i==1 || i==2 || i==3 || i==4 || i==5){
loop=true;
}
if(loop==false){
System.out.println("Invalid. Type : \n1 to edit your profile \n2 to view it \n3 to see a Chat \n4 to send a message \n5 to log out");
}
} catch(InputMismatchException e){
System.out.println("You must enter a number.Type : \n1 to edit your profile \n2 to view your profile \n3 to see a Chat \n4 to send a message \n5 to log out");
System.out.println();
sc.nextLine();
}
}while(loop==false);
athlete.edit(1, "Default");
athlete.edit(3, "Default");
athlete.edit(4, "Default");
athlete.edit(5, "Default");
athlete.edit(6, "Default");
athlete.edit(7,0.0);
athlete.edit(8,0.0);
athlete.edit(2,0);
if (i == 1) {
//the athletes choose what to change from their profile
System.out.println("What do you want to change? 1:name, 2:age, 3:sport, 4:bio, 5:position, 6:current_team, 7:height, 8:weight");
Scanner sc1 = new Scanner(System.in);
int num=0;
boolean loop2=false;
do{
try{
num = sc1.nextInt();
if(num==1 || num==2 || num==3 || num==4||num==5 || num==6 || num==7 || num==8 ){
loop2=true;
}
if(loop2==false){
System.out.println("Invalid. Pick 1:name, 2:age, 3:sport, 4:bio, 5:position, 6:current_team, 7:height, 8:weight");
}
} catch(InputMismatchException e){
System.out.println("You must enter a number. Pick 1:name, 2:age, 3:sport, 4:bio, 5:position, 6:current_team, 7:height, 8:weight");
sc1.nextLine();
}
}while(loop2==false);
if (num == 1 || num == 3 || num == 4 || num ==5 || num == 6) {
System.out.println("insert the new value");
Scanner sc2 = new Scanner(System.in);
String s = sc2.nextLine();
athlete.edit(num, s);
}
else if ( num == 7 || num == 8 ) {
System.out.println("insert the new value");
Scanner sc3 = new Scanner(System.in);
boolean continueLoop = true;
do{
try {
double d = sc3.nextDouble();
continueLoop = false;
athlete.edit(num, d);
} catch(InputMismatchException e){
System.out.println("Please enter a number :");
sc3.nextLine();
}
} while(continueLoop);
} else if (num == 2){
System.out.println("insert the new value");
Scanner sc4 = new Scanner(System.in);
boolean continueLoop2 = true;
do{
try {
int integ = sc4.nextInt();
continueLoop2 = false;
athlete.edit(num, integ);
} catch (InputMismatchException e) {
System.out.println("Please enter a number :");
sc4.nextLine();
}
}while(continueLoop2);
}
} else if (i == 2){ //the whole profile is displayed
athleteact.showProfile();
} else if (i==3) { //the athlete chose to see a chat with a coach
input1 = new Scanner(System.in);
System.out.println("With whom? Enter username");
//the athlete enters the username of the coach
usernameuser = input1.nextLine();
flag1 = false;
do {
for (Coaches c: coachesarray) {
if (c.getUsername().equals(usernameuser)) {
flag1 = true;
athleteact.seeWholeConversation(c);
break;
}
}
if(flag1 == false) {
System.out.println("There is no coach with this username, write one of the usernames below:");
for (Coaches b: coachesarray) {
System.out.println(b.getUsername()); //all the usernames are being displayed so that a coach can be chosen
}
System.out.println("Enter Username");
usernameuser = input1.nextLine();
}
} while (flag1==false);
} else if (i==4) { //the athlete chose to send a message
System.out.println("To who? Enter username");
//the athlete enters the username of the coach
usernameuser = input1.nextLine();
flag1 = false;
do {
for (Coaches c: coachesarray) {
if (c.getUsername().equals(usernameuser )) {
flag1 = true;
athleteact.sendNewMessage(c);
break;
}
}
if(flag1== false) {
System.out.println("There is no coach with this username, write one of the usernames below:");
//all the usernames are being displayed so that a coach can be chosen
for (Coaches c: coachesarray) {
System.out.println(c.getUsername());
}
System.out.println("Enter Username");
usernameuser= input1.nextLine();
}
} while (flag1==false);
} else {
System.out.println("You logged out successfully.");
flaglg=true;
}
}while( i != 5);
} else { //for coach
//object creations and addition to arraylist
Coaches coach = new Coaches(username1,password,choice);
coachesarray.add(coach);
CoachActions coachact = new CoachActions(athletesearray, coach,athletesearray.size());
int i=0;
do{
System.out.println();
//the menu of the application
System.out.println("Type \n1 to edit your profile \n2 to view it \n3 to search for athletes \n4 to see a Chat \n5 to send a message \n6 to log out");
Scanner sc4 = new Scanner(System.in);
do{
try{
i = sc4.nextInt();
if(i==1 || i==2 || i==3 || i==4 || i==5 || i==6){
break;
}
System.out.println("Invalid. Type \n1 to edit your profile \n2 to view it \n3 to search for athletes \n4 to see a Chat \n5 to send a message \n6 to logout");
}catch ( InputMismatchException e) {
System.out.println("You must enter a number. Type \n1 to edit your profile \n2 to view it \n3 to search for athletes \n4 to see a Chat \n5 to send a message \n6 to logout");
sc4.nextLine();
}
}while(i!=1 && i!=2 && i!=3 && i!=4 && i!=5 && i!= 6);
//loops until it receives a proper input
if (i == 1) {
//the coaches choose what to change from their profile
System.out.println("What do you want to change? 1:name, 2:age, 3:sport, 4:bio, 5:years_of_experience, 6:team");
Scanner sc5 = new Scanner(System.in);
int num=0;
do{
try{
num = sc5.nextInt();
if(num==1 || num==2 || num==3 || num==4 || num==5 || num== 6){
break;
}
System.out.println("Invalid. 1:name, 2:age, 3:sport, 4:bio, 5:years_of_experience, 6:team ");
}catch ( InputMismatchException e) {
System.out.println("You must enter a number. 1:name, 2:age, 3:sport, 4:bio, 5:years_of_experience, 6:team ");
sc5.nextLine();}
}while(num!=1 && num!=2 && num !=3 && num !=4 && num !=5 &&num !=6);
if (num == 2 || num == 5 ) {
System.out.println("insert the new value");
Scanner sc6 = new Scanner(System.in);
boolean continueLoop3 = true;
do{
try {
int y = sc6.nextInt();
coach.edit(num, y);
continueLoop3 = false;
} catch(InputMismatchException e){
System.out.println("Please enter a number :");
sc6.nextLine();
}
} while(continueLoop3);
}else if (num == 1 || num == 3 || num == 4 || num == 6) {
System.out.println("insert the new value");
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
coach.edit(num, s);
}
} else if (i == 2){
coachact.showProfile();//Do
}
else if (i==3) {
coachact.showAthletes();
} else if(i==4) {
input1 = new Scanner(System.in);
System.out.println("With whom? Enter username");
usernameuser = input1.nextLine();
flag = false;
do {
for (Athletes a: athletesearray) {
if (a.getUsername().equals(usernameuser)) {
flag = true;
coachact.seeWholeConversation(a);
break;
}
}
if(flag == false) {
System.out.println("There is no athlete with this username, write one of the usernames below:");
for (Athletes b: athletesearray) {
System.out.println(b.getUsername());
}
System.out.println("Enter Username");
usernameuser= input1.nextLine();
}
} while (flag==false);
} else if (i ==5) {
System.out.println("To who? Enter username");
usernameuser = input1.nextLine();
boolean flag1 = false;
do {
for (Athletes a: athletesearray) {
if (a.getUsername().equals(usernameuser)) {
flag1 = true;
coachact.sendNewMessage(a);
break;
}
}
if(flag1 == false) {
System.out.println("There is no athlete with this username, write one of the usernames below:");
for (Athletes b: athletesearray) {
System.out.println(b.getUsername());
}
System.out.println("Enter Username");
usernameuser= input1.nextLine();
}
} while (flag1==false);
} else {
System.out.println("You logged out successfully.");
flaglg=true;
}
}while(i!=6);
}
//LOG IN
} else {
System.out.println("Enter username");
Scanner myObj = new Scanner(System.in);
String username1 = myObj.nextLine();
System.out.println("Enter Password");
String password1= myObj.nextLine();
boolean flag=true;
Users x = usersarray.get(0); //initializing x so that it can be used in lines 313 and 320
while (flag==true){
for (Users q : usersarray){
if (q.getUsername().equals(username1) && q.getPassword().equals(password1)){
flag=false;
System.out.println("You logged in successfully.");
x = q;
break;
}
}
if (flag==true) {
System.out.println("This username does not exist or password is incorrect. Try again...Insert Username");
username1 = myObj.nextLine();
System.out.println("Enter Password");
password1= myObj.nextLine();
}
}
Athletes athlete = athletesearray.get(0);
int identity = 0;
String usernametemp=x.getUsername();
for (Athletes ac : athletesearray) {
if (usernametemp.equals(ac.getUsername())) {
identity = 1;
athlete = ac;
}
}
Coaches coach = coachesarray.get(0);
for (Coaches xc : coachesarray) {
if (usernametemp.equals(xc.getUsername())) {
identity = 2;
coach=xc;
}
}
Scanner input1 = new Scanner(System.in);
//for athletes
String usernameuser;
if (identity == 1) {
AthletesActions athleteact = new AthletesActions(athlete);
int i=1;
do {
System.out.println();
//the menu of the application
System.out.println("Type \n1 to edit your profile \n2 to view it \n3 to see a Chat \n4 to send a message \n5 to log out");
Scanner sc = new Scanner(System.in);
boolean flag1;
do {
try{
i = sc.nextInt();
if(i==1 || i==2 || i==3 || i==4 || i==5) {
break;
}
System.out.println("Invalid. Type \n1 to edit your profile \n2 to view it \n3 to see a Chat \n4 to send a message \n5 to log out");
} catch ( InputMismatchException e) {
System.out.println("You must enter a number. Type \n1 to edit your profile \n2 to view it \n3 to see a Chat \n4 to send a message \n5 to log out");
sc.nextLine();
}
}while(i!=1 && i!=2 && i!=3 && i!=4 && i!=5 );
if (i == 1) {
//the athletes choose what to change from their profile
System.out.println("What do you want to change? 1:name, 2:age, 3:sport, 4:bio, 5:position, 6:current_team, 7:height, 8:weight");
Scanner sc1 = new Scanner(System.in);
int num=0;
do {
try {
num = sc1.nextInt();
if(num==1 || num==2 || num==3 || num==4||num==5 || num==6 || num==7 || num==8 ) {
break;
}
System.out.println("Invalid. Pick 1:name, 2:age, 3:sport, 4:bio, 5:position, 6:current_team, 7:height, 8:weight");
} catch ( InputMismatchException e) {
System.out.println("You must enter a number. Pick 1:name, 2:age, 3:sport, 4:bio, 5:position, 6:current_team, 7:height, 8:weight");
sc1.nextLine();
}
}while(num!=1 && num!=2 && num!=3 && num!=4 && num!=5 && num!=6 && num!=7 && num!=8 );
if (num == 1 || num == 3 || num == 4 || num ==5 || num == 6) {
System.out.println("insert the new value");
Scanner sc2 = new Scanner(System.in);
String s = sc2.nextLine();
athlete.edit(num, s);
}
else if ( num == 7 || num == 8 ) {
System.out.println("insert the new value");
Scanner sc3 = new Scanner(System.in);
boolean continueLoop = true;
do{
try {
double d = sc3.nextDouble();
continueLoop = false;
athlete.edit(num, d);
} catch(InputMismatchException e){
System.out.println("Please enter a number :");
sc3.nextLine();
}
} while(continueLoop);
} else if (num == 2) {
System.out.println("insert the new value");
Scanner sc4 = new Scanner(System.in);
boolean continueLoop2 = true;
do{
try {
int integ = sc4.nextInt();
continueLoop2 = false;
athlete.edit(num, integ);
} catch (InputMismatchException e) {
System.out.println("Please enter a number :");
sc4.nextLine();
}
}while(continueLoop2);
}
} else if (i == 2) {
athleteact.showProfile();
} else if (i==3) {
input1 = new Scanner(System.in);
System.out.println("With whom? Enter username");
usernameuser = input1.nextLine();
flag1 = false;
do {
for (Coaches c: coachesarray) {
if (c.getUsername().equals(usernameuser)) {
flag1 = true;
athleteact.seeWholeConversation(c);
break;
}
}
if(flag1 == false) {
System.out.println("There is no coach with this username, write one of the usernames below:");
for (Coaches b: coachesarray) {
System.out.println(b.getUsername());
}
System.out.println("Enter Username");
usernameuser = input1.nextLine();
}
} while (flag1==false);
} else if (i == 4) {
System.out.println("To who? Enter username");
usernameuser = input1.nextLine();
flag1 = false;
do {
for (Coaches c: coachesarray) {
if (c.getUsername().equals(usernameuser )) {
flag1 = true;
athleteact.sendNewMessage(c);
break;
}
}
if(flag1== false) {
System.out.println("There is no coach with this username, write one of the usernames below:");
for (Coaches b: coachesarray) {
System.out.println(b.getUsername());
}
System.out.println("Enter Username");
usernameuser= input1.nextLine();
}
} while (flag1==false);
} else {
System.out.println("You logged out successfully.");
flaglg=true;
}
}while(i!=5);
} else { //for coach
CoachActions coachact = new CoachActions(athletesearray, coach,athletesearray.size());
int i=0;
do{
System.out.println();
//the menu of the application
System.out.println("Type \n1 to edit your profile \n2 to view it \n3 to search for athletes \n4 to see a Chat \n5 to send a message \n6 to logout");
Scanner sc4 = new Scanner(System.in);
do{
try{
i = sc4.nextInt();
if(i==1 || i==2 || i==3 || i==4 || i==5 || i == 6){
break;
}
System.out.println("Invalid. Type \n1 to edit your profile \n2 to view it \n3 to search for athletes \n4 to see a Chat \n5 to send a message \n6 to logout");
} catch ( InputMismatchException e) {
System.out.println("You must enter a number. Type \n1 to edit your profile \n2 to view it \n3 to search for athletes \n4 to see a Chat \n5 to send a message \n6 to logout");
sc4.nextLine();
}
}while(i!=1 && i!=2 && i!=3 && i!=4 && i!=5 && i!=6);
if (i == 1) {
System.out.println("What do you want to change? 1:name, 2:age, 3:sport, 4:bio, 5:years_of_experience, 6:team");
Scanner sc5 = new Scanner(System.in);
int num=0;
do{
try{
num = sc5.nextInt();
if(num==1 || num==2||num==3 || num==4 || num==5 || num== 6) {
break;
}
System.out.println("Invalid. 1:name, 2:age, 3:sport, 4:bio, 5:years_of_experience, 6:team ");
} catch ( InputMismatchException e) {
System.out.println("You must enter a number. 1:name, 2:age, 3:sport, 4:bio, 5:years_of_experience, 6:team ");
sc5.nextLine();
}
}while(num!=1 && num!=2 && num !=3 && num !=4 && num !=5 &&num !=6);
if (num == 2 || num == 5 ) {
System.out.println("insert the new value");
Scanner sc6 = new Scanner(System.in);
boolean continueLoop4 = true;
do{
try {
int y = sc6.nextInt();
coach.edit(num, y);
continueLoop4 = false;
} catch(InputMismatchException e){
System.out.println("Please enter a number :");
sc6.nextLine();
}
} while(continueLoop4);
}
else if (num == 1 || num == 3 || num == 4 || num == 6) {
System.out.println("insert the new value");
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
coach.edit(num, s);
}
} else if (i == 2) {
coachact.showProfile();
}
else if (i==3) {
coachact.showAthletes();
} else if(i==4) {
input1 = new Scanner(System.in);
System.out.println("With whom? Enter username");
usernameuser = input1.nextLine();
flag = false;
do {
for (Athletes a: athletesearray) {
if (a.getUsername().equals(usernameuser)) {
flag = true;
coachact.seeWholeConversation(a);
break;
}
}
if(flag == false) {
System.out.println("There is no athlete with this username, write one of the usernames below:");
for (Athletes b: athletesearray) {
System.out.println(b.getUsername());
}
System.out.println("Enter Username");
usernameuser= input1.nextLine();
}
} while (flag==false);
} else if (i == 5) {
System.out.println("To who? Enter username");
usernameuser = input1.nextLine();
boolean flag1 = false;
do {
for (Athletes a: athletesearray) {
if (a.getUsername().equals(usernameuser)) {
flag1 = true;
coachact.sendNewMessage(a);
break;
}
}
if(flag1 == false) {
System.out.println("There is no athlete with this username, write one of the usernames below:");
for (Athletes b: athletesearray) {
System.out.println(b.getUsername());
}
System.out.println("Enter Username");
usernameuser= input1.nextLine();
}
} while (flag1==false);
} else {
System.out.println("You logged out successfully.");
flaglg=true;
}
}while(i!=6);
}
}
FileOutputStream fos = new FileOutputStream("UserInfo.ser");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(usersarray);
oos.close();
fos.close();
FileOutputStream fosath = new FileOutputStream("AthleteInfo.ser");
ObjectOutputStream oosath = new ObjectOutputStream(fosath);
oosath.writeObject(athletesearray);
oosath.close();
fosath.close();
FileOutputStream foscoa = new FileOutputStream("CoachInfo.ser");
ObjectOutputStream ooscoa = new ObjectOutputStream(foscoa);
ooscoa.writeObject(coachesarray);
ooscoa.close();
foscoa.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
return;
}
catch (ClassNotFoundException c)
{
System.out.println("Class not found");
c.printStackTrace();
return;
}
}
}