Browse Source

Merge remote-tracking branch 'origin/fdai7600'

remotes/origin/fdai7780
fdai7600 11 months ago
parent
commit
90d6ae9538
  1. 12
      src/main/java/org/example/Administration.java
  2. 1
      src/main/java/org/example/Main.java
  3. 9
      src/main/java/org/example/Student.java

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

@ -552,6 +552,18 @@ public class Administration {
return false; return false;
} }
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 {
System.out.println("Student with ID " + studentId + " not found.");
}
}
} }

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

@ -96,6 +96,7 @@ public class Main {
break; break;
case 10: case 10:
// View Grades from Student // View Grades from Student
administration.viewGradesFromStudent();
break; break;
case 11: case 11:

9
src/main/java/org/example/Student.java

@ -111,6 +111,13 @@ public class Student {
this.courseGrades.put(course, grade); this.courseGrades.put(course, grade);
} }
public void printGrades() {
System.out.println("Grades for Student ID: " + this.studentId + ", Name: " + this.studentName);
for (Map.Entry<Course, String> entry : courseGrades.entrySet()) {
Course course = entry.getKey();
String grade = entry.getValue();
System.out.println("Course: " + course.getCourseName() + " (" + course.getCourseID() + "), Grade: " + (grade != null ? grade : "Not graded yet"));
}
}
} }
Loading…
Cancel
Save