Browse Source

refactoring: Changed to Map instead of list to store both Course and grades

remotes/origin/fdai7780
fdai7600 11 months ago
parent
commit
fe4b78b1ea
  1. 12
      src/main/java/org/example/Student.java

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

@ -2,7 +2,9 @@ package org.example;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Represents an student user in the system.
@ -12,7 +14,7 @@ public class Student {
String studentName;
String studentId;
String studentRole;
List<Course> courses = new ArrayList<>();
Map<Course, String> courseGrades = new HashMap<>();
public Student(){
@ -55,12 +57,12 @@ public class Student {
this.studentRole = studentRole;
}
public List<Course> getCourses() {
return courses;
public Map<Course, String> getCourseGrades() {
return courseGrades;
}
public void setCourses(List<Course> courses) {
this.courses = courses;
public void setCourseGrades(Map<Course, String> courseGrades) {
this.courseGrades = courseGrades;
}
/**

Loading…
Cancel
Save