Question: Rewrite the Course class in Listing 10.6. Use an Array List to replace an array to store students. Draw the new UML diagram for the

Rewrite the Course class in Listing 10.6. Use an Array List to replace an array to store students. Draw the new UML diagram for the class. You should not change the original contract of the Course class (i.e., the definition of the constructors and methods should not be changed, but the private members may be changed.)
 Rewrite the Course class in Listing 10.6. Use an Array List

import java.util.ArrayList; public class Course private String courseName; private ArrayList students new ArrayListString>(); public Course (String courseName) this.courseName courseName; public void addStudent (String student) [ students.add (student); public String getCourseName () f return courseName public ArrayList getStudents) [ return students; public int getNumberOfStudents () return students.size); public void dropStudent (String student) students.remove (student)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!