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

Rewrite the Course class in Listing 10.6. Use an ArrayList to replace the array to store students. Draw a 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 ArrayList to replace

public class Course private String courseName; private String[] students = new String[100]; private int numberOfStudents; public Course(String courseName) this. courseName = courseName; public void addStudent (String student) students [numberOfStudents] -student; numberOfStudents++ public String[] getStudentsO f return students; public int getNumberOfStudentsO f return numberOf Students; public String getCourseNameO return courseName; public void dropStudent(String student) // Left as an exercise in Programming Exercise 10.9

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!