Question: Revise the Course class as follows: Revise the getStudents() method to return an array whose length is the same as the number of students
Revise the Course class as follows:
■ Revise the getStudents() method to return an array whose length is the same as the number of students in the course.
■ The array size is fixed in Listing 10.6. Revise the addStudent method to automatically increase the array size if there is no room to add more students. This is done by creating a new larger array and copying the contents of the current array to it.
■ Implement the dropStudent method.
■ Add a new method named clear() that removes all students from the course.
Test your program using https://liveexample.pearsoncmg.com/test/
Exercise10_09.txt
Step by Step Solution
3.45 Rating (168 Votes )
There are 3 Steps involved in it
public class Exercise1009 public static void mainString args CourseNew course1 new CourseNewData Structures CourseNew course2 new CourseNewDatabase Sy... View full answer
Get step-by-step solutions from verified subject matter experts
