Question: public class Course { private String courseName; private String[] students = new String[30]; private int numberOfStudents; public Course(String courseName) { this.courseName = courseName; } public
public class Course {
private String courseName;
private String[] students = new String[30];
private int numberOfStudents;
public Course(String courseName) {
this.courseName = courseName;
}
public void addStudent(String student) {
students[numberOfStudents] = student;
numberOfStudents++;
}
public String getCourseName() {
return courseName;
}
public String[] getStudents() {
return students;
}
public int getNumberOfStudents() {
return numberOfStudents;
}
public void dropStudent(String student) {
for (int i = 0; i
if (students[i].equals(student)) {
for (int j=i+1; j
students[j - 1] = students[j];
numberOfStudents--;
return;
}
}
}
}
Please help me make a java programming
3. Revise the Course class that we created in class as follows: 1. Improve it to automatically increase the array when we need to add more students than the capacity of the array. After creating the new array, copy the contents of the old array to the new one. Start with a capacity of 5 and increase by 5 when needed. 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 2. 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
