I need to "It will then call Student.addCourse with newly created Enrollment object," and I am wondering if I am doing this correctly.
this is my course reg class where i need to do this in
public Enrollment add(String RUID, String index){ Enrollment r = null; Student s = studentRecordController.getStudent(RUID); Course c = courseOfferingController.getCourse(index); Enrollment e = new Enrollment(s,c); this.student.addCourse(e); this.course.addEnrollment(e); return r;
heres my student class
// add an registered course to the list public Enrollment addCourse(Enrollment e){ // add it to the Hashtable using its id as the key enrollments.put(e.getStudent(), e); return e; }
is this correct? It needs to add what classes this student is taking in the enrollments hash table.
Also question instead of having addCourse(Enrollment e) could i have addCourse(String RUID string index)? Our professor gave us the structure but idk why he has it enrollment e. There is a class called Enrollment but i dont see why we need it.
here is the enrollment classpublic class Enrollment { Student student; Course course; String grade; public Enrollment (Student studentS, Course courseC ){ student = studentS; course = courseC; } public void setCourse(Course course) { this.course = course; } public Course getCourse() { return course; } public void setGrade(String grade) { this.grade = grade; } public String getGrade() { // when assign a grade to a student // you also need to recalculate GPA return grade; } public void setStudent(Student student) { this.student = student; } public Student getStudent() { return student; } }