Class Roster: This class will implement the functionality of all roster for school. It will , in essence, manage an ArrayList of Student objects.
- Class or static variables
Java1public static final int MAX_NUM
representing the maximum number of students allowed on the roster
- Instance Variables
: an ArrayList storing Student Objects
//during which period of the day does this roster meet
- a default constructor should initialize the list to empty strings
- single parameter constructor with the period as a parameter
Both constructors should initialize the instance variables
- private int indexOf(Student st)//@returns index of Student St or -1
- public boolean containsStudent(Student st)//@returns true if studentName is in roster
- public boolean containsStudent(int ssnId) //@returns true if a student in the list has that SSN
- public Student retrieveBySSNId(int ssnId ) //@ returns Student associated with id. This should return null if the student does not exist.
- public boolean equals(ClassRoster other) //@ returns whether or not rosters are equal
- public String toString()
- public boolean addStudent( Student st ) ;//if the size of the arraylist is less than MAX_NUM, add the student and return true; otherwise, return false and do not add student.
- public boolean addStudent(String studentName, int age) ;//adds student name and age to end of roster
- Make sure that the total number of students does not exceed MAX_NUM.
- public Student removeStudent(int ssnId ) // removes student from roster based on id.
- public Student removeStudent(String name) //removes student based on name.
- public Student removeStudent( Student st) //removes student st.