Question: -Task 2.8 Bring over your newly improved Student.java and Course.java code from 2.7. In this task, you will be making similar modifications to the Course




-Task 2.8 Bring over your newly improved Student.java and Course.java code from 2.7. In this task, you will be making similar modifications to the Course class. Instead of the numOfStudents field, we want an ArrayList that will store all of the Students enrolled in this course. Do the following: + 1. Replace the numofstudents field with a new field called enrolled students. It should be an ArrayList. 2. Modify the addNewStudent() method so that it now adds the input parameter (i.e. the Student object) to the enrolledStudents ArrayList. There should be no duplicates! Duplicate Students have the same id Similarly to Course, Student objects are distinctly identifiable by their id. Main.java Couro.java Student.java import java.util.ArrayList; public class Course private final String title Il title of the course private final String code; // course code private ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
