forked from zorianak/Student-Gradebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgradeBook.java
executable file
·748 lines (597 loc) · 23.3 KB
/
gradeBook.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
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
/*Kim Holmes
CSC 20
Dr Wang
*/
import javax.swing.*; //imported for the construction of GUI
import java.awt.*;
import java.awt.event.*;
import java.io.*; //standard Java input/output package
import java.io.Serializable;
import java.util.*;
public class gradeBook {
//set all of our variables
static JFrame frame = new JFrame("Teacher's Gradebook");
static JTextField userOption = new JTextField("", 6);
static JTextField studentCount = new JTextField("0", 3);
static JTextField studentID = new JTextField("", 17);
static JTextField studentName = new JTextField("", 16);
static JTextField studentGender = new JTextField("", 6);
static JTextField studentAge = new JTextField("", 5);
static JTextField studentLevel = new JTextField("", 8);
static JTextField seekSID = new JTextField("", 9);
static JTextField setLabNumber = new JTextField("", 6);
static JTextField setScore = new JTextField("", 3);
static JLabel studentScore = new JLabel("Score for: ");
static JLabel studentPosition = new JLabel("student 0 of 0");
//radio buttons for student's gender
static String femaleString = "F";
static String maleString = "M";
//placeholder
static String sexString = "Sexy";
static JRadioButton femaleButton = new JRadioButton(femaleString);
static JRadioButton maleButton = new JRadioButton(maleString);
static JRadioButton sexualButton = new JRadioButton(sexString);
//radio buttons for student's class level
static String classLevel0 = "0";
static String classLevel1 = "1";
static String classLevel2 = "2";
static String classLevel3 = "3";
static String classLevel4 = "4";
static JRadioButton class0Button = new JRadioButton(classLevel0);
static JRadioButton class1Button = new JRadioButton(classLevel1);
static JRadioButton class2Button = new JRadioButton(classLevel2);
static JRadioButton class3Button = new JRadioButton(classLevel3);
static JRadioButton class4Button = new JRadioButton(classLevel4);
//buttons for the different panes
static JButton saveButton = new JButton("Save & Add Students");
static JButton addMainMenu = new JButton("Back to menu");
static JButton deleteMainMenu = new JButton("Back to menu");
static JButton labMainMenu = new JButton("Back to menu");
static JButton displayMainMenu = new JButton("Back to menu");
//set up part of GUI
static CardLayout graphicalInterface = new CardLayout();
static JPanel studentRegistry = new JPanel(graphicalInterface);
static LinkedList<Student> studentList= new LinkedList<Student>();
static JTextArea showStudentsTextArea;
//start code for the program itself
static public class Student implements Serializable {
//set info for students
int ID = 0, age = 0, classLevel = 0;
char gender = 'S';
String name = "haxor";
//lab score array w/ placeholders in thar
int[] labScores = {0,0,0,0,0,0,0,0,0,0,0,0};
//setup these variables as accessible methods
public void setID(int ID) {
this.ID = ID;
}
public void setGender(char gender) {
this.gender = gender;
}
public void setAge(int age) {
this.age = age;
}
public void setClassLevel(int classLevel) {
this.classLevel = classLevel;
}
public void setName(String name) {
this.name = name;
}
public void setLabScores(int labNumber, int score) {
labScores[labNumber-1] = score;
}
public int getID() {
return ID;
}
public String studentName() {
return name;
}
public String toString() {
String studentPeople = ID +" " + gender + " " + age + " " + classLevel +" "+ name + " ";
for(int i = 0; i < labScores.length; i++) {
studentPeople += labScores[i] + " ";
}
return studentPeople;
}
}
public static void main(String[] args) {
ButtonActionListener buttonListener = new ButtonActionListener();
JPanel contentPane = (JPanel)frame.getContentPane();
//Creates menu pane and initializes its pieces
JPanel menuPane = new JPanel(new FlowLayout(1,250,10));
JLabel label = new JLabel("CSC 20 Gradebook");
JLabel[] options = new JLabel[10];
JLabel choiceLabel = new JLabel("Choice: ");
Container choicePane = new Container();
choicePane.setLayout(new FlowLayout());
choicePane.add(choiceLabel);
//set the interface options
options[0] = new JLabel("================");
options[1] = new JLabel("0. Open the Student File");
options[2] = new JLabel("1. Add Students ");
options[3] = new JLabel("2. Delete Students ");
options[4] = new JLabel("3. Enter Lab Scores ");
options[5] = new JLabel("4. Display Students ");
options[6] = new JLabel("5. Save File and Exit ");
options[7] = new JLabel("================");
options[8] = new JLabel("Number of Students: ");//implement l8r
//menu pane(menuPane) filled with labels and text field
userOption.addActionListener(buttonListener);
choicePane.add(userOption);
label.setHorizontalAlignment(JLabel.CENTER);
menuPane.add(label);
for(int i = 0; i <= 7; i++) {
options[i].setHorizontalAlignment(JLabel.CENTER);
menuPane.add(options[i]);
if(i == 6) {
menuPane.add(choicePane);
}
}
//pane for the number of students=
Container numOfStudentPane = new Container();
numOfStudentPane.setLayout(new FlowLayout());
numOfStudentPane.add(options[8]);
studentCount.setEditable(false);
numOfStudentPane.add(studentCount);
menuPane.add(numOfStudentPane);
graphicalInterface.addLayoutComponent(menuPane, "menu");
studentRegistry.add(menuPane, "menu");
//Makes Add Student interface; makes input fields and options
JPanel panel1 = new JPanel(new FlowLayout(1,250,10));
panel1.add(new JLabel("Enter Student information"));
panel1.add(new JLabel("============================"));
//pane for student ID
Container SIDPane = new Container();
SIDPane.setLayout(new FlowLayout());
SIDPane.add(new JLabel("SID:"));
SIDPane.add(studentID);
//takes the name
Container NamePane = new Container();
NamePane.setLayout(new FlowLayout());
NamePane.add(new JLabel("Name:"));
NamePane.add(studentName);
//sex label
Container studentGenderPane = new Container();
studentGenderPane.setLayout(new FlowLayout());
studentGenderPane.add(new JLabel("Sex:"));
//buttons for male/female
studentGenderPane.add(femaleButton);
femaleButton.setActionCommand(femaleString);
studentGenderPane.add(maleButton);
maleButton.setActionCommand(maleString);
maleButton.setSelected(false);
sexualButton.setActionCommand(sexString);
sexualButton.setSelected(true);
//make a button group for possible selections
ButtonGroup group = new ButtonGroup();
group.add(maleButton);
group.add(femaleButton);
group.add(sexualButton);
//Button listeners and actions for male/female option
maleButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
studentGender.setText("M");
}
});
femaleButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
studentGender.setText("F");
}
});
//this option is here as a "dummy" option to deselect other buttons
sexualButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
studentGender.setText("S");
}
});
studentGenderPane.add(new JLabel(" Age:"));
studentGenderPane.add(studentAge);
Container classPane = new Container();
classPane.setLayout(new FlowLayout());
classPane.add(new JLabel("Class Level:"));
//buttons for class level
classPane.add(class1Button);
class1Button.setActionCommand(classLevel1);
class1Button.setSelected(false);
classPane.add(class2Button);
class2Button.setActionCommand(classLevel2);
class2Button.setSelected(false);
classPane.add(class3Button);
class3Button.setActionCommand(classLevel3);
class3Button.setSelected(false);
classPane.add(class4Button);
class4Button.setActionCommand(classLevel4);
class4Button.setSelected(false);
class0Button.setActionCommand(classLevel0);
class0Button.setSelected(true);
//make a button group for possible selections
ButtonGroup group2 = new ButtonGroup();
group2.add(class1Button);
group2.add(class2Button);
group2.add(class3Button);
group2.add(class4Button);
group2.add(class0Button);
//Button listeners and actions for class level option
class1Button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
studentLevel.setText("1");
}
});
class2Button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
studentLevel.setText("2");
}
});
class3Button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
studentLevel.setText("3");
}
});
class4Button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
studentLevel.setText("4");
}
});
class0Button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
studentLevel.setText("0");
}
});
Container addStudentButtonPane = new Container();
addStudentButtonPane.setLayout(new FlowLayout());
addStudentButtonPane.add(saveButton);
addStudentButtonPane.add(addMainMenu);
panel1.add(SIDPane);
panel1.add(NamePane);
panel1.add(studentGenderPane);
panel1.add(classPane);
panel1.add(addStudentButtonPane);
//why are we adding these again? They're ugly
panel1.add(new JLabel("============================"));
graphicalInterface.addLayoutComponent(panel1, "add student");
studentRegistry.add(panel1, "add student");
saveButton.addActionListener(buttonListener);
addMainMenu.addActionListener(buttonListener);
//construction of delete student pane
JPanel panel2 = new JPanel(new FlowLayout(1,250,15));
panel2.add(new JLabel("Delete Student"));
panel2.add(new JLabel("======================="));
Container deleteStudentPane = new Container();
deleteStudentPane.setLayout(new FlowLayout());
deleteStudentPane.add(new JLabel("Student ID:"));
seekSID.addActionListener(buttonListener);
deleteStudentPane.add(seekSID);
deleteStudentPane.add(deleteMainMenu);
panel2.add(deleteStudentPane);
panel2.add(deleteMainMenu);
graphicalInterface.addLayoutComponent(panel2, "delete student");
studentRegistry.add(panel2, "delete student");
deleteMainMenu.addActionListener(buttonListener);
//construction of lab scores pane
JPanel panel3 = new JPanel(new FlowLayout(1,250,10));
panel3.add(new JLabel("Enter Lab Scores"));
panel3.add(new JLabel("========================="));
//requests the lab number
Container labNumberPane = new Container();
labNumberPane.setLayout(new FlowLayout(1,2,30));
labNumberPane.add(new JLabel("Lab Number:"));
labNumberPane.add(setLabNumber);
Container labScorePane = new Container();
labScorePane.setLayout(new FlowLayout(1,1,20));
//adds the student's score into the lab array for that student
labScorePane.add(studentScore);
setScore.addActionListener(buttonListener);
labScorePane.add(setScore);
labScorePane.add(studentPosition);
panel3.add(labNumberPane);
panel3.add(labScorePane);
panel3.add(labMainMenu);
labMainMenu.addActionListener(buttonListener);
graphicalInterface.addLayoutComponent(panel3, "lab scores");
studentRegistry.add(panel3, "lab scores");
//construction of display student pane
JPanel panel4 = new JPanel(new FlowLayout(1,250,10));
panel4.add(new JLabel("Student List"));
showStudentsTextArea = new JTextArea(10,25);
JScrollPane studentScrollArea = new JScrollPane(showStudentsTextArea);
studentScrollArea.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
studentScrollArea.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
panel4.add(studentScrollArea);
displayMainMenu.addActionListener(buttonListener);
panel4.add(displayMainMenu);
graphicalInterface.addLayoutComponent(panel4, "show students");
studentRegistry.add(panel4, "show students");
contentPane.add(studentRegistry);
frame.pack();
frame.setSize(350,350);
frame.setResizable(false);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
static class ButtonActionListener implements ActionListener {
int studentNumber = 0, index = 0, choice = 0;
public void actionPerformed(ActionEvent e) {
//check to see if choice was made
try {
choice = Integer.parseInt(userOption.getText());
if(!(choice >= 0 && choice <= 5)) {
JOptionPane.showMessageDialog(null,"Please enter an Integer between 0 and 5","Invalid Choice", JOptionPane.ERROR_MESSAGE);
userOption.setText("");
return;
}
}
catch(Exception x) {
JOptionPane.showMessageDialog(null,"Please enter an Integer between 0 and 5","Invalid Choice Input", JOptionPane.ERROR_MESSAGE);
userOption.setText("");
return;
}
//this switch determines what pane opens whenever you input a number into the "choice" box
switch(choice) {
case 0:
break;
case 1:
graphicalInterface.show(studentRegistry, "add student");
break;
case 2:
graphicalInterface.show(studentRegistry, "delete student");
break;
case 3:
graphicalInterface.show(studentRegistry, "lab scores");
break;
case 4:
graphicalInterface.show(studentRegistry, "show students");
break;
case 5:
break;
}
//Back to Menu button code
if(e.getSource() == addMainMenu || e.getSource() == deleteMainMenu || e.getSource() == labMainMenu || e.getSource() == displayMainMenu) {
userOption.setText("");
studentID.setText("");
studentName.setText("");
studentGender.setText("");
studentAge.setText("");
studentLevel.setText("");
graphicalInterface.show(studentRegistry, "menu");
showStudentsTextArea.setText("");
sexualButton.setSelected(true);
class0Button.setSelected(true);
return;
}
//Add Students Code
if(e.getSource() == saveButton) {
int ID = 0, age = 0, classLevel = 0;
char gender = ' ';
String name = "";
class0Button.setSelected(true);
//This will see if a valid student ID was input
try {
ID = Integer.parseInt(studentID.getText());
if((Integer.toString(ID).length()) != 9)
{
JOptionPane.showMessageDialog(null,"Invalid SID, must be a series of 9 integer values","Invalid SID", JOptionPane.ERROR_MESSAGE);
studentID.setText("");
return;
}
}
catch(Exception x) {
JOptionPane.showMessageDialog(null,"Invalid SID, must be a series of 9 integer values","Invalid SID", JOptionPane.ERROR_MESSAGE);
studentID.setText("");
return;
}
//This will see if a gender is chosen
try {
gender = (studentGender.getText()).charAt(0);
String GenderString = Character.toString(gender);
}
catch(Exception x) {
JOptionPane.showMessageDialog(null,"Select F or M to denote your Gender","Gender Error", JOptionPane.ERROR_MESSAGE);
studentGender.setText("");
sexualButton.setSelected(true);
return;
}
//get student age; checks for no/invalid input
try {
age = Integer.parseInt(studentAge.getText());
if(!(age >= 1 && age <= 99)) {
JOptionPane.showMessageDialog(null,"Age must be an integer value between 1 and 99","Invalid Age", JOptionPane.ERROR_MESSAGE);
studentAge.setText("");
return;
}
}
catch(Exception x) {
JOptionPane.showMessageDialog(null,"Please enter an age for the student","Missing Input", JOptionPane.ERROR_MESSAGE);
studentAge.setText("");
return;
}
//get student class level; checks for no/invalid input
try {
classLevel = Integer.parseInt(studentLevel.getText());
}
catch(Exception x) {
JOptionPane.showMessageDialog(null,"Please choose a class level","Invalid Class Level", JOptionPane.ERROR_MESSAGE);
class0Button.setSelected(true);
return;
}
name = studentName.getText();
String [] validName = name.split("\\s");
if(validName.length != 2) {
JOptionPane.showMessageDialog(null,"You must enter both first and last name, nothing else","Cannot read instructions error", JOptionPane.ERROR_MESSAGE);
studentName.setText("");
return;
}
String studentNameData = "";
for(int i = 0; i < validName.length; i++) {
if(i == 1) {
studentNameData += validName[i].charAt(0);
}
else{
studentNameData += validName[i] + " ";
}
}
Student studentRecord = new Student();
studentRecord.setID(ID);
studentRecord.setGender(gender);
studentRecord.setAge(age);
studentRecord.setClassLevel(classLevel);
studentRecord.setName(studentNameData);
studentList.addLast(studentRecord);
studentNumber++;
studentCount.setText("" + studentNumber);
userOption.setText("");
studentID.setText("");
studentName.setText("");
studentGender.setText("");
studentAge.setText("");
studentLevel.setText("");
graphicalInterface.show(studentRegistry, "menu");
sexualButton.setSelected(true);
}
//Open the Student File Code
if(choice == 0) {
FileInputStream fileStream = null;
ObjectInputStream loadFile = null;
try {
String filename = "IwishIhadAcheezeburger.nfo";
fileStream = new FileInputStream(filename);
loadFile = new ObjectInputStream(fileStream);
}catch(Exception x){JOptionPane.showMessageDialog(null,"File not found: No students to load","Invalid option", JOptionPane.ERROR_MESSAGE);};
try {
while(true) {
studentList.add((Student)loadFile.readObject());
studentNumber++;
studentCount.setText("" + studentNumber);
}
}catch(Exception x){};
userOption.setText("");
}
//Delete Students Code
if(choice == 2) {
if(studentList.size() == 0) {
JOptionPane.showMessageDialog(null,"No students to delete","Empty Gradebook error", JOptionPane.ERROR_MESSAGE);
graphicalInterface.show(studentRegistry, "menu");
userOption.setText("");
}
}
if(e.getSource() == seekSID ) {
int deleteID = 0;
boolean IDexists = false;
try {
deleteID = Integer.parseInt(seekSID.getText());
}
catch(Exception x) {
JOptionPane.showMessageDialog(null,"Invalid SID, must be a series of 9 integer values","Invalid SID for deletion", JOptionPane.ERROR_MESSAGE);
}
for(Student studentRecord: studentList) {
if(studentRecord.getID() == deleteID) {
studentList.remove(studentList.indexOf(studentRecord));
studentNumber--;
studentCount.setText("" + studentNumber);
IDexists = true;
seekSID.setText("");
break;
}
}
if(IDexists == false) {
JOptionPane.showMessageDialog(null,"ID not found in Gradebook","Invalid SID for deletion", JOptionPane.ERROR_MESSAGE);
}
userOption.setText("");
seekSID.setText("");
graphicalInterface.show(studentRegistry, "menu");
}
//Enter Lab Scores Code
if(choice == 3 && e.getSource() != setScore) {
if(studentList.size() == 0) {
JOptionPane.showMessageDialog(null,"No students to Enter grades for","Empty Gradebook error", JOptionPane.ERROR_MESSAGE);
graphicalInterface.show(studentRegistry, "menu");
userOption.setText("");
}
Student studentData;
if(studentList.size() != 0) {
studentData = studentList.get(index);
studentScore.setText("Score for " + studentData.studentName() + ": ");
studentPosition.setText("Student " + (studentList.indexOf(studentData)+1) +" of " + studentList.size());
}
}
if(e.getSource() == setScore) {
int labNumber = 0, labScore = 0;
try {
labNumber = Integer.parseInt(setLabNumber.getText());
if(!(labNumber >= 0 && labNumber <= 12)) {
JOptionPane.showMessageDialog(null,"Invalid lab number: please enter an integer between 1 and 12","Invalid lab number", JOptionPane.ERROR_MESSAGE);
setLabNumber.setText("");
return;
}
}
catch(Exception x) {
JOptionPane.showMessageDialog(null,"Invalid lab number: please enter an integer between 1 and 12","Invalid lab number", JOptionPane.ERROR_MESSAGE);
setLabNumber.setText("");
return;
}
try {
labScore = Integer.parseInt(setScore.getText());
if(labScore >= 0 && labScore <= 100) {
JOptionPane.showMessageDialog(null,"Invalid score: please enter an integer between 1 and 100","Invalid score", JOptionPane.ERROR_MESSAGE);
setScore.setText("");
return;
}
}
catch(Exception x) {
JOptionPane.showMessageDialog(null,"Invalid score: please enter an integer between 1 and 100","Invalid score", JOptionPane.ERROR_MESSAGE);
setScore.setText("");
return;
}
Student studentData;
if(studentList.size() != 0) {
studentData = studentList.get(index);
studentData.setLabScores(labNumber, labScore);
if(studentList.get(index) == studentList.getLast()) {
graphicalInterface.show(studentRegistry, "menu");
userOption.setText("");
return;
}
else {
index++;
studentData = studentList.get(index);
}
studentScore.setText("Score for " + studentData.studentName() + ": ");
studentPosition.setText("Student " + (studentList.indexOf(studentData)+1) +" of " + studentList.size());
setScore.setText("");
}
}
else if (e.getSource() != setScore && choice == 3 && e.getSource() != userOption) {
graphicalInterface.show(studentRegistry, "menu");
userOption.setText("");
return;
}
//Display Students Code
if(choice == 4) {
if(studentList.size() != 0) {
for(Student studentData: studentList) {
showStudentsTextArea.append(studentData.toString()+ "\n");
}
return;
}
else{
JOptionPane.showMessageDialog(null,"No students to show","Empty Gradebook error", JOptionPane.ERROR_MESSAGE);
graphicalInterface.show(studentRegistry, "menu");
userOption.setText("");
return;
}
}
//Save File and Exit Code
if(choice == 5) {
String filename = "IwishIhadAcheezeburger.nfo";
try {
FileOutputStream fileStream = new FileOutputStream(filename);
ObjectOutputStream saveFile = new ObjectOutputStream(fileStream);
for(Student studentData: studentList) {
saveFile.writeObject(studentData);
}
saveFile.close();
}catch(Exception x){};
System.exit(0);
}
}
}
}