Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 rivate members may be changed.)
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago