-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudentManagementSystem.java
More file actions
830 lines (651 loc) · 23.8 KB
/
Copy pathstudentManagementSystem.java
File metadata and controls
830 lines (651 loc) · 23.8 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
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
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
import java.util.*;
class studentManagementSystem {
public static final Scanner input = new Scanner(System.in);
public static String [] studentIdArray = new String[0];
public static String [] studentNameArray = new String[0];
public static int [] prfMarksArray = new int[0];
public static int [] dbmsMarksArray = new int[0];
public static int [] totalArray = new int[0];
public static double [] averageArray = new double [0];
public static int [] rankArray = new int [0];
public static int nextIndex = 0;
public static int studentIdCounter = 1;
//---------------------- find best in Dbms ------------------------------
public static void sortDbmsMarkArray(){
for(int i=nextIndex-1; i >= 0 ; i--){
for(int j=0; j<i; j++){
if(dbmsMarksArray[j] < dbmsMarksArray[j+1]){
int tempPrfMarksArray = prfMarksArray[j];
prfMarksArray[j]=prfMarksArray[j+1];
prfMarksArray[j+1]=tempPrfMarksArray;
String tempStudentIdArray = studentIdArray[j];
studentIdArray[j]=studentIdArray[j+1];
studentIdArray[j+1]=tempStudentIdArray;
String tempStudentNameArray =studentNameArray[j];
studentNameArray[j]=studentNameArray[j+1];
studentNameArray[j+1]=tempStudentNameArray;
int tempDbmsMarksArray = dbmsMarksArray[j];
dbmsMarksArray[j]=dbmsMarksArray[j+1];
dbmsMarksArray[j+1]=tempDbmsMarksArray;
}
}
}
}
//---------------------- find best in Prf ------------------------------
public static void sortPrfMarksArray(){
for(int i=nextIndex-1; i >= 0 ; i--){
for(int j=0; j<i; j++){
if(prfMarksArray[j] < prfMarksArray[j+1]){
int tempPrfMarksArray = prfMarksArray[j];
prfMarksArray[j]=prfMarksArray[j+1];
prfMarksArray[j+1]=tempPrfMarksArray;
String tempStudentIdArray = studentIdArray[j];
studentIdArray[j]=studentIdArray[j+1];
studentIdArray[j+1]=tempStudentIdArray;
String tempStudentNameArray =studentNameArray[j];
studentNameArray[j]=studentNameArray[j+1];
studentNameArray[j+1]=tempStudentNameArray;
int tempDbmsMarksArray = dbmsMarksArray[j];
dbmsMarksArray[j]=dbmsMarksArray[j+1];
dbmsMarksArray[j+1]=tempDbmsMarksArray;
}
}
}
}
//------------------------- find Rank ----------------------------------
public static void findRank(){
for (int i = 0; i < nextIndex; i++) {
int rank = 1;
for (int j = 0; j < nextIndex; j++) {
if (totalArray[j] > totalArray[i]) {
rank++;
}
}
rankArray[i] = rank;
}
}
//------------------------- sort Arrays --------------------------------
public static void sortArrays(){
for(int i=nextIndex-1; i >= 0 ; i--){
for(int j=0; j<i; j++){
if(totalArray[j] < totalArray[j+1]){
String tempStudentIdArray = studentIdArray[j];
studentIdArray[j]=studentIdArray[j+1];
studentIdArray[j+1]=tempStudentIdArray;
String tempStudentNameArray =studentNameArray[j];
studentNameArray[j]=studentNameArray[j+1];
studentNameArray[j+1]=tempStudentNameArray;
int tempPrfMarksArray = prfMarksArray[j];
prfMarksArray[j]=prfMarksArray[j+1];
prfMarksArray[j+1]=tempPrfMarksArray;
int tempDbmsMarksArray = dbmsMarksArray[j];
dbmsMarksArray[j]=dbmsMarksArray[j+1];
dbmsMarksArray[j+1]=tempDbmsMarksArray;
int tempTotalArray = totalArray[j];
totalArray[j]=totalArray[j+1];
totalArray[j+1]=tempTotalArray;
double tempAverageArray = averageArray[j];
averageArray[j]=averageArray[j+1];
averageArray[j+1]=tempAverageArray;
}
}
}
}
//-------------------------- get Average -------------------------------
public static double getAverage(int total){
double average = total/2;
return average;
}
//---------------------------- get Total -------------------------------
public static int getTotal(int prfMarks, int dbmsMarks){
int total = prfMarks + dbmsMarks;
return total;
}
//------------------ narrow Arrays -------------------------------------
public static void narrowArray(){
String[] tempStudentIdArray = new String[nextIndex];
String[] tempStudentNameArray = new String[nextIndex];
int[] tempPrfMarksArray = new int [nextIndex];
int[] tempDbmsMarksArray = new int[nextIndex];
int[] tempTotalArray = new int[nextIndex];
double[] tempAverageArray = new double[nextIndex];
int[] tempRankArray = new int [nextIndex];
for (int i = 0; i < nextIndex; i++){
tempStudentIdArray[i] = studentIdArray[i];
tempStudentNameArray[i] = studentNameArray[i];
tempPrfMarksArray[i] = prfMarksArray[i];
tempDbmsMarksArray[i] = dbmsMarksArray[i];
tempTotalArray[i] = totalArray[i];
tempAverageArray[i] = averageArray[i];
tempRankArray[i] = rankArray[i];
}
studentIdArray = tempStudentIdArray;
studentNameArray = tempStudentNameArray;
prfMarksArray = tempPrfMarksArray;
dbmsMarksArray = tempDbmsMarksArray;
totalArray = tempTotalArray;
averageArray = tempAverageArray;
rankArray = tempRankArray;
}
//----------------- is Marks Added -------------------------------------
public static boolean isMarksAdded(String stuId){
int index = findStudentIndex(stuId);
if (index == -1) {
return false;
}else{
return prfMarksArray[index]!=0 && dbmsMarksArray[index]!=0;
}
}
//------------------ Find Student Index --------------------------------
public static int findStudentIndex(String stuId){
for (int i = 0; i <nextIndex ; i++){
if (studentIdArray[i].equals(stuId)){
return i;
}
}
return -1;
}
//------------------ get Valid Student Id (for searching)---------------
public static String getValidStudentId(){
String stuId;
while(true){
System.out.print("Enter Student ID : ");
stuId = input.next();
if (isIdExist(stuId)){
return stuId;
}else{
System.out.print("Invalid Student ID. Do you want to search again ? (Y/n): ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch)=='n'){
return null;
}
}
}
}
//------------------ get Valid Marks -----------------------------------
public static int getValidMarks(String subject){
int marks;
while(true){
System.out.print(subject+"Marks : ");
marks = input.nextInt();
if (marks>= 0 && marks <= 100){
return marks;
}else{
System.out.println("Invalid Marks, Please enter Correct Marks.");
}
}
}
//------------------- check student Id exist or not --------------------
public static boolean isIdExist(String stuId){
for (int i = 0; i <nextIndex ; i++){
if(studentIdArray[i].equals(stuId)){
return true;
}
}
return false;
}
//---------------------- Student Id Generate (Auto) --------------------
public static String generateStudentId() {
String id = String.format("S%03d", studentIdCounter);
studentIdCounter++;
return id;
}
//------------------- Extend Arrays ------------------------------------
public static void extendArrays(){
String[] tempStudentIdArray = new String [studentIdArray.length+1];
String[] tempStudentNameArray = new String [studentNameArray.length+1];
int[] tempPrfMarksArray = new int [prfMarksArray.length+1];
int[] tempDbmsMarksArray = new int [dbmsMarksArray.length+1];
int[] tempTotalArray = new int [totalArray.length+1];
double[] tempAverageArray = new double [averageArray.length+1];
int[] tempRankArray = new int [rankArray.length+1];
for (int i = 0; i < studentIdArray.length; i++){
tempStudentIdArray[i] = studentIdArray[i];
tempStudentNameArray[i] = studentNameArray[i];
tempPrfMarksArray[i] = prfMarksArray[i];
tempDbmsMarksArray[i] = dbmsMarksArray[i];
tempTotalArray[i] = totalArray[i];
tempAverageArray[i] = averageArray[i];
tempRankArray[i] = rankArray[i];
}
studentIdArray = tempStudentIdArray;
studentNameArray = tempStudentNameArray;
prfMarksArray = tempPrfMarksArray;
dbmsMarksArray = tempDbmsMarksArray;
totalArray = tempTotalArray;
averageArray = tempAverageArray;
rankArray = tempRankArray;
}
//------------------- Best in Database Management ----------------------
public static void bestInDbms(){
System.out.println("-------------------------------------------------");
System.out.println("| BEST IN DATABASE MANAGEMENT SYSTEM |");
System.out.println("-------------------------------------------------");
System.out.println();
System.out.println();
System.out.println("+------+-------------------+-------------+------------+");
System.out.println("|ID |Student's Name |Dbms Marks |prf Marks |");
System.out.println("+------+-------------------+-------------+------------+");
sortDbmsMarkArray();
for (int i = 0; i < nextIndex; i++){
if (totalArray[i]!=0){
System.out.printf("|%6s|%19s|%13d|%12d|",studentIdArray[i],studentNameArray[i],dbmsMarksArray[i],prfMarksArray[i]);
System.out.println();
}
}
System.out.print("+------+-------------------+-------------+------------+");
System.out.println();
System.out.print("\nDo you want to go back to main menu (Y/n)? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'y'){
clearConsole();
homePage();
}
System.exit(0);
}
//------------------- Best in Programming Fundementals -----------------
public static void bestInPrf(){
System.out.println("-------------------------------------------------");
System.out.println("| BEST IN PROGRAMMING FUNDEMENTALS |");
System.out.println("-------------------------------------------------");
System.out.println();
System.out.println();
System.out.println("+------+-------------------+------------+------------+");
System.out.println("|ID |Student's Name |Prf Marks |Dbms Marks |");
System.out.println("+------+-------------------+------------+------------+");
sortPrfMarksArray();
for (int i = 0; i < nextIndex; i++){
if (totalArray[i]!=0){
System.out.printf("|%6s|%19s|%12d|%12d|",studentIdArray[i],studentNameArray[i],prfMarksArray[i],dbmsMarksArray[i]);
System.out.println();
}
}
System.out.print("+------+-------------------+------------+------------+");
System.out.println();
System.out.print("\nDo you want to go back to main menu (Y/n)? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'y'){
clearConsole();
homePage();
}
System.exit(0);
}
//------------------- Print Students Ranks -----------------------------
public static void printStudentRarks(){
System.out.println("-------------------------------------------------");
System.out.println("| PRINT STUDENTS' RANKS |");
System.out.println("-------------------------------------------------");
System.out.println();
System.out.println();
findRank();
System.out.println("+------+------+-------------------+--------------+--------------+");
System.out.println("|Rank |ID |Student's Name |Total Marks |Avg. Marks |");
System.out.println("+------+------+-------------------+--------------+--------------+");
for (int i = 0; i < nextIndex; i++){
if (totalArray[i]!=0){
System.out.printf("|%6d|%6s|%19s|%14d|%14.1f|",rankArray[i],studentIdArray[i],studentNameArray[i],totalArray[i],averageArray[i]);
System.out.println();
}
}
System.out.print("+------+------+-------------------+--------------+--------------+");
System.out.println();
System.out.print("\nDo you want to go back to main menu (Y/n)? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'y'){
clearConsole();
homePage();
}
}
//------------------- Print Students Details ---------------------------
public static void printStudentDetails(){
System.out.println("-------------------------------------------------");
System.out.println("| PRINT STUDENT DETAILS |");
System.out.println("-------------------------------------------------");
System.out.println();
while(true){
String stuId = getValidStudentId();
if (stuId == null){
break;
}
int index = findStudentIndex(stuId);
System.out.println("Student Name : "+studentNameArray[index]);
if (!isMarksAdded(stuId)){
System.out.println("\nMarks yet to be Added.");
System.out.print("Do you want to search another student details(Y/n)? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'n'){
clearConsole();
homePage();
}
clearConsole();
printStudentDetails();
}else{
System.out.println("+---------------------------------+----------+");
System.out.printf("|Programming Fundamentals Marks |%10d|",prfMarksArray[index]);
System.out.printf("\n|Database Management System Marks |%10d|",dbmsMarksArray[index]);
System.out.printf("\n|Total Marks |%10d|",totalArray[index]);
System.out.printf("\n|Avg. Marks |%10.1f|",averageArray[index]);
System.out.printf("\n|Rank |%3d(place)|",rankArray[index]);
System.out.println("\n+---------------------------------+----------+");
System.out.print("\nDo you want to search another student details(Y/n)? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'n'){
clearConsole();
homePage();
}
clearConsole();
printStudentDetails();
}
}
clearConsole();
homePage();
}
//------------------- Delete Student -----------------------------------
public static void deleteStudent(){
System.out.println("-------------------------------------------------");
System.out.println("| DELETE STUDENT |");
System.out.println("-------------------------------------------------");
System.out.println();
while(true){
String stuId = getValidStudentId();
if (stuId == null){
break;
}
int index = findStudentIndex(stuId);
for (int i = index; i < nextIndex - 1; i++){
studentIdArray[i] = studentIdArray[i+1];
studentNameArray[i] = studentNameArray[i+1];
prfMarksArray[i] = prfMarksArray[i+1];
dbmsMarksArray[i] = dbmsMarksArray[i+1];
totalArray[i] = totalArray[i+1];
averageArray[i] = averageArray[i+1];
rankArray[i] = rankArray[i+1];
}
nextIndex--;
narrowArray();
System.out.println("Student has been deleted successfully.");
System.out.print("Do you want to delete another student (Y/n)? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'n'){
break;
}
clearConsole();
deleteStudent();
}
clearConsole();
homePage();
}
//------------------- update Marks -------------------------------------
public static void updateMarks(){
System.out.println("-------------------------------------------------");
System.out.println("| UPDATE MARKS |");
System.out.println("-------------------------------------------------");
System.out.println();
while(true){
String stuId = getValidStudentId();
if (stuId == null){
break;
}
int index = findStudentIndex(stuId);
System.out.println("Student Name : "+studentNameArray[index]);
if (!isMarksAdded(stuId)){
System.out.println("This Student's Marks yet to be Added.");
}else{
System.out.println("Programming Fundamentals Marks : "+prfMarksArray[index]);
System.out.println("Database Management System Marks : "+dbmsMarksArray[index]);
int prfMarks = getValidMarks("Programming Fundementals ");
int dbmsMarks = getValidMarks("Database Management System ");
int total = getTotal(prfMarks,dbmsMarks);
double average = getAverage(total);
prfMarksArray[index] = prfMarks;
dbmsMarksArray[index] = dbmsMarks;
totalArray[index] = total;
averageArray[index] = average;
System.out.println("Student's Marks have been updated successfully.");
}
System.out.print("Do you want to update another student's Marks (Y/n)? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'n'){
break;
}
clearConsole();
updateMarks();
}
clearConsole();
homePage();
}
//------------------- Update Student Details ---------------------------
public static void updateStudentDetails(){
System.out.println("-------------------------------------------------");
System.out.println("| UPDATE STUDENT DETAILS |");
System.out.println("-------------------------------------------------");
System.out.println();
while (true){
String stuId = getValidStudentId();
if (stuId == null){
break;
}
int index = findStudentIndex(stuId);
System.out.println("Student Name : "+studentNameArray[index]);
System.out.print("Enter the new Student Name : ");
String stuNewName = input.next();
studentNameArray[index] = stuNewName;
System.out.println("Student Details has been updated successfully.");
System.out.print("Do you want to update another student details (Y/n)? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'n'){
break;
}
clearConsole();
updateStudentDetails();
}
clearConsole();
homePage();
}
//------------------- add Marks ----------------------------------------
public static void addMarks(){
System.out.println("-------------------------------------------------");
System.out.println("| ADD MARKS |");
System.out.println("-------------------------------------------------");
System.out.println();
while (true){
String stuId = getValidStudentId();
if (stuId == null){
break;
}
int index = findStudentIndex(stuId);
if (isMarksAdded(stuId)){
System.out.println("This student's marks have been already added.");
System.out.println("If you want to update the marks, please use [5] Update Marks option.");
}else{
System.out.println("Student Name : "+studentNameArray[index]);
int prfMarks = getValidMarks("Programming Fundementals ");
int dbmsMarks = getValidMarks("Database Management System ");
int total = getTotal(prfMarks,dbmsMarks);
double average = getAverage(total);
prfMarksArray[index] = prfMarks;
dbmsMarksArray[index] = dbmsMarks;
totalArray[index] = total;
averageArray[index] = average;
System.out.println("Student's Marks have been added successfully.");
}
System.out.print("Do you want to add marks for another student (Y/n)? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'n'){
break;
}
clearConsole();
addMarks();
}
clearConsole();
homePage();
}
//------------------- add New Student With Marks -----------------------
public static void addNewStudentWithMarks(){
System.out.println("-------------------------------------------------");
System.out.println("| ADD NEW STUDENT WITH MARKS |");
System.out.println("-------------------------------------------------");
System.out.println();
while(true){
String stuId;
while(true){
stuId = generateStudentId();
System.out.print("Enter Student ID\t: "+stuId);
if(isIdExist(stuId)){
System.out.println("The Student ID already exists.");
}else{
break;
}
}
System.out.print("\nEnter Student Name\t: ");
String stuName = input.next();
int prfMarks = getValidMarks("Programming Fundementals ");
int dbmsMarks = getValidMarks("Database Management System ");
int total = getTotal(prfMarks,dbmsMarks);
double average = getAverage(total);
extendArrays();
studentIdArray[nextIndex] = stuId;
studentNameArray[nextIndex] = stuName;
prfMarksArray[nextIndex] = prfMarks;
dbmsMarksArray[nextIndex] = dbmsMarks;
totalArray[nextIndex] = total;
averageArray[nextIndex] = average;
nextIndex++;
System.out.println("Student has been added successfully.");
System.out.print("Do you want to add a new student (Y/n) ? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'n'){
break;
}
clearConsole();
addNewStudentWithMarks();
}
clearConsole();
homePage();
}
//------------------- add New Student ----------------------------------
public static void addNewStudent(){
System.out.println("-------------------------------------------------");
System.out.println("| ADD NEW STUDENTS |");
System.out.println("-------------------------------------------------");
System.out.println();
while(true){
String stuId;
while(true){
stuId = generateStudentId();
System.out.print("Enter Student ID\t: "+stuId);
if(isIdExist(stuId)){
System.out.println("The Student ID already exists.");
}else{
break;
}
}
System.out.print("\nEnter Student Name\t: ");
String stuName = input.next();
extendArrays();
studentIdArray[nextIndex] = stuId;
studentNameArray[nextIndex] = stuName;
prfMarksArray[nextIndex] = 0;
dbmsMarksArray[nextIndex] = 0;
totalArray[nextIndex] = 0;
averageArray[nextIndex] = 0;
nextIndex++;
System.out.println("Student has been added successfully.");
System.out.print("Do you want to add a new student (Y/n) ? ");
char ch = input.next().charAt(0);
if(Character.toLowerCase(ch) == 'n'){
break;
}
clearConsole();
addNewStudent();
}
clearConsole();
homePage();
}
//------------------- home page ----------------------------------------
public static void homePage(){
System.out.println("-------------------------------------------------");
System.out.println("| WELCOME TO GDSE MARKS MANAGEMENT SYSTEM |");
System.out.println("-------------------------------------------------");
System.out.println();
System.out.print("[1] Add New Student");
System.out.print("\t\t\t[2] Add New Student With Marks");
System.out.print("\n[3] Add Marks");
System.out.print("\t\t\t\t[4] Update Student Details");
System.out.print("\n[5] Update Marks");
System.out.print("\t\t\t[6] Delete Students");
System.out.print("\n[7] Print Student Details");
System.out.print("\t\t[8] Print Student Ranks");
System.out.print("\n[9] Best in Programing Fundamentals");
System.out.print("\t[10] Best in Database Management System");
System.out.print("\n[11] Exit");
System.out.println();
System.out.print("\nEnter an Option to Continue > ");
int option = input.nextInt();
switch(option) {
case 1:
clearConsole();
addNewStudent();
break;
case 2:
clearConsole();
addNewStudentWithMarks();
break;
case 3:
clearConsole();
addMarks();
break;
case 4:
clearConsole();
updateStudentDetails();
break;
case 5:
clearConsole();
updateMarks();
break;
case 6:
clearConsole();
deleteStudent();
break;
case 7:
clearConsole();
printStudentDetails();
break;
case 8:
clearConsole();
printStudentRarks();
break;
case 9:
clearConsole();
bestInPrf();
break;
case 10:
clearConsole();
bestInDbms();
break;
case 11:
clearConsole();
System.exit(0);
break;
}
}
//------------------ clear console -------------------------------------
public final static void clearConsole() {
try {
final String os = System.getProperty("os.name");
if (os.contains("Windows")) {
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
}else {
System.out.print("\033[H\033[2J");
System.out.flush();
}
} catch (final Exception e) {
e.printStackTrace();
// Handle any exceptions.
}
}
//------------------- main method --------------------------------------
public static void main (String[] args) {
homePage();
}
}