-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdministrator.java
More file actions
299 lines (263 loc) · 12.7 KB
/
Administrator.java
File metadata and controls
299 lines (263 loc) · 12.7 KB
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
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Administrator {
String adname = "Anna";
String adsurname = "Manolaki";
String password = "a1234";
Student student = new Student();
Tutor tutor = new Tutor();
Course course = new Course();
Grade grade = new Grade();
Scanner input = new Scanner(System.in);
Administrator(){}
/**
*Το μενού της εφαρμογής
*Έλεγχοι που πραγματοποιούνται:
* έλεγχος για εισαγωγή αριθμού εκτός επιλογών μενού
* έλεγχος για εισαγωγή οποιουδήποτε άλλου συνδυασμού ψηφίων εκτός αριθμού(int)
*/
public void menu() {
while (true) {
System.out.println("========================================================\n");
System.out.println("Welcome to Main Menu!\n");
System.out.println("Please Select a choice from the following: \n");
System.out.println("========================================================");
System.out.println("Press 1 to View all Student Info");
System.out.println("Press 2 to View all Tutor Info");
System.out.println("Press 3 to View all Courses Info ");
System.out.println("Press 4 for Tutor Management");
System.out.println("Press 5 for Student Management");
System.out.println("Press 6 for Course Management");
System.out.println("Press 7 for Grade Management");
System.out.println("Press 8 to Sign Out");
System.out.println("========================================================");
try {
int choice = input.nextInt();
if (choice == 1) {
viewStudent();
Pause();
} else if (choice == 2) {
viewTutor();
Pause();
} else if (choice == 3) {
viewCourse();
Pause();
} else if (choice == 4) {
manageTutorInfo();
Pause();
} else if (choice == 5) {
manageStudent();
Pause();
} else if (choice == 6) {
manageCourse();
Pause();
} else if (choice == 7) {
manageGrades();
Pause();
} else if (choice == 8) {
System.out.println("Signing Out!\n\n");
break;
} else {
System.out.println("You entered wrong input. Please try again.");
}
} catch (InputMismatchException e) {
System.out.println("You entered wrong input. Please try again.");
}
}
}
public void viewStudent ()
{
student.viewAllStudent();
}
public void viewTutor() { tutor.viewAllTutor(); }
public void viewCourse() { course.viewCourse();}
/**
*@manageTutorInfo Το υπομενού της εφαρμογής που διαχειρίζεται τις εγγραφές των Καθηγητών
*Έλεγχοι που πραγματοποιούνται:
* έλεγχος για εισαγωγή αριθμού εκτός επιλογών μενού
* έλεγχος για εισαγωγή οποιουδήποτε άλλου συνδυασμού ψηφίων εκτός αριθμού(int)
*/
public void manageTutorInfo() {
while (true) {
System.out.println("=========================================\n");
System.out.println("Welcome to Tutor Management\n");
System.out.println("=========================================\n");
System.out.println("Press 1 to create a Tutor Info");
System.out.println("Press 2 to modify a Tutor Info");
System.out.println("Press 3 to delete a Tutor");
System.out.println("Press 4 to add a course to a Tutor");
System.out.println("Press 5 to View Tutor Info");
System.out.println("Press 6 to return to Main Menu");
System.out.println("=========================================\n");
try {
int choice = input.nextInt();
if (choice == 1) {
tutor.createTutor();
Pause();
} else if (choice == 2) {
tutor.modifyTutorInfo();
Pause();
} else if (choice == 3) {
tutor.deleteTutor();
Pause();
} else if (choice == 4) {
tutor.addCourseToTutor();
Pause();
} else if (choice == 5) {
tutor.viewTutorInfo();
Pause();
} else if (choice == 6) {
break;
} else {
System.out.println("You entered wrong input. Please try again.");
}
} catch (InputMismatchException | IOException e) {
System.out.println("You entered wrong input. Please try again.");
manageTutorInfo();
}
}
}
/**
*@manageStudent Το υπομενού της εφαρμογής που διαχειρίζεται τις εγγραφές των Φοιτητών
*Έλεγχοι που πραγματοποιούνται:
* έλεγχος για εισαγωγή αριθμού εκτός επιλογών μενού
* έλεγχος για εισαγωγή οποιουδήποτε άλλου συνδυασμού ψηφίων εκτός αριθμού(int)
*/
public void manageStudent() {
while (true) {
System.out.println("=========================================\n");
System.out.println("Student Management Menu\n");
System.out.println("=========================================\n");
System.out.println("Press 1 to create a Student Info");
System.out.println("Press 2 to modify a Student Info");
System.out.println("Press 3 to delete a Student Info");
System.out.println("Press 4 to view a Student Info");
System.out.println("Press 5 to view all Students Info");
System.out.println("Press 6 to add a course to a Student");
System.out.println("Press 7 to return to Main Menu");
System.out.println("=========================================\n");
try {
int choice = input.nextInt();
if (choice == 1) {
student.createStudent();
Pause ();
} else if (choice == 2) {
student.modifyStudentInfo();
Pause ();
} else if (choice == 3) {
student.deleteStudentInfo();
Pause ();
} else if (choice == 4) {
student.viewStudentInfo();
Pause ();
} else if (choice == 5) {
student.viewAllStudent();
Pause ();
} else if (choice == 6) {
student.addCourseToStudent();
Pause ();
} else if (choice == 7) {
break;
} else {
System.out.println("You entered wrong input. Please try again.");
}
} catch (InputMismatchException | IOException e) {
System.out.println("You entered wrong input. Please try again.");
manageStudent();
}
}
}
/**
*@manageCourse Το υπομενού της εφαρμογής που διαχειρίζεται τις εγγραφές των Μαθημάτων
*Έλεγχοι που πραγματοποιούνται:
* έλεγχος για εισαγωγή αριθμού εκτός επιλογών μενού
* έλεγχος για εισαγωγή οποιουδήποτε άλλου συνδυασμού ψηφίων εκτός αριθμού(int)
*/
public void manageCourse() {
while (true) {
System.out.println("=========================================\n");
System.out.println("Welcome to Course Management\n");
System.out.println("=========================================\n");
System.out.println("Press 1 to create a course");
System.out.println("Press 2 to modify a course");
System.out.println("Press 3 to delete a course");
System.out.println("Press 4 to return to Main Menu");
System.out.println("=========================================\n");
try {
int choice = input.nextInt();
if (choice == 1) {
course.createCourse();
Pause ();
} else if (choice == 2) {
course.modifyCourse();
Pause ();
} else if (choice == 3) {
Pause ();
course.deleteCourse();
} else if (choice == 4) {
break;
} else {
System.out.println("You entered wrong input. Please try again.");
}
} catch (InputMismatchException e) {
System.out.println("You entered wrong input. Please try again.");
manageCourse();
}
}
}
/**
*Το @manageGrades() υπομενού της εφαρμογής που διαχειρίζεται τους βαθμούς των Φοιτητών και τα βαθμολογικά στατιστικά στοιχεία
* με βάση τον αριθμό μητρώου του φοιτητή και τον κωδικό μαθήματος.
*Έλεγχοι που πραγματοποιούνται:
* έλεγχος για εισαγωγή αριθμού εκτός επιλογών μενού
* έλεγχος για εισαγωγή οποιουδήποτε άλλου συνδυασμού ψηφίων εκτός αριθμού(int)
*/
public void manageGrades() {
while (true) {
System.out.println("=========================================\n");
System.out.println("Welcome to Grades Management\n");
System.out.println("=========================================\n");
System.out.println("Press 1 to insert Student grade");
System.out.println("Press 2 to view all Student grades");
System.out.println("Press 3 to view average Student grades");
System.out.println("Press 4 to view average Course grades");
System.out.println("Press 5 to return to Main Menu");
System.out.println("=========================================\n");
// Να προσθέσω την επιλογή για διαγραφή και να αφαιρέσω το rename
try {
int choice = input.nextInt();
if (choice == 1) {
grade.createGrade();
Pause();
} else if (choice == 2) {
grade.viewGrade();
Pause();
} else if (choice == 3) {
grade.averstudent();
Pause();
} else if (choice == 4) {
grade.avercourse();
Pause();
} else if (choice == 5) {
break;
} else {
System.out.println("You entered wrong input. Please try again.");
}
} catch (InputMismatchException | IOException e) {
System.out.println("You entered wrong input. Please try again.");
manageGrades();
}
}
}
/**
*Μέθοδος παύσης της εκτέλεσης του προγράμματος μέχρι να πατηθεί Enter
*/
public void Pause () {
Scanner P = new Scanner(System.in);
System.out.println("");
System.out.printf("Press ENTER to continue.");
P.nextLine ();
System.out.println ("");
}
}