Question
You will keep track of the course name, the names of the students, and the number of students in a course. The main method is provided for you and you will not change anything in it.
The program will be able to add students, drop students, see the name of the course and find out how many students are currently enrolled in the course.
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
/** To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
/**
*
* @author
*/
public class Course {
private String courseName;
private ArrayList<String> students = new ArrayList<>();
public Course(String courseName){
this.courseName = courseName;
}
public void addStudent(String student){
if (students.size() < 100) {
students.add(student);
}
}
public int getNumberStudents(){
return students.size();
}
public void showStudents(){
for(int i = 0; i < students.size(); i++) {
System.out.println(students.get(i));
}
}
public String getCourseName(){
return courseName;
}...