Browse Source

refactoring: encapsulated the input handling related with case 10

remotes/origin/fdai7780
fdai7600 11 months ago
parent
commit
c80a4dd636
  1. 5
      src/main/java/org/example/Administration.java
  2. 4
      src/main/java/org/example/Main.java

5
src/main/java/org/example/Administration.java

@ -552,8 +552,11 @@ public class Administration {
return false;
}
public void viewGradesFromStudent(String studentId) {
public void viewGradesFromStudent() {
System.out.print("Enter Student ID to view grades: ");
String studentId = scanner.next();
Student student = findStudentById(studentId);
if (student != null) {
student.printGrades();
} else {

4
src/main/java/org/example/Main.java

@ -96,9 +96,7 @@ public class Main {
break;
case 10:
// View Grades from Student
System.out.print("Enter Student ID to view grades: ");
String studentId = scanner.next();
administration.viewGradesFromStudent(studentId);
administration.viewGradesFromStudent();
break;
case 11:

Loading…
Cancel
Save