** 10.9 (The Course class) 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. (Hint: create a new array and copy students to it.) The array size is fixed in Listing 10.6. Revise the addStudent method to automatically increase the array size it 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. Write a test program that creates a course, adds three students, removes one, and displays the students in the course.
I need help with an Introduction to Java 11th edition book question. I already have a test program so don't worry about the last part.
** 10.9 (The Course class) 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. (Hint: create a new array and copy students to it.) The array size is fixed in Listing 10.6. Revise the addStudent method to automatically increase the array size it 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. Write a test program that creates a course, adds three students, removes one, and displays the students in the course.
Step by step
Solved in 2 steps