Class Roster Java Assignment

Class Roster: This class will implement the functionality of all roster for school. It will , in essence, manage an ArrayList of Student objects.

Client file:   tester file

  • Class or static variables

    • 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

Constructors

  • 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

Methods

  • Accessors
    • private int indexOf(Student st) //@returns index of Student St or -1
    • public boolean contains(Student st) //@returns true if studentName is in roster
    • public boolean contains(int ssnId)  //@returns true if a student in the list has that SSN
    • public int getPeriod() // returns period
    • 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 ArrayList<Student> getStudents() //@returns the ArrayList of all students in the roster
    • public String toString()

Mutators:

  • 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.

2 thoughts on “Class Roster Java Assignment

  1. Pingback: Student Class - Mr. M online

  2. Pingback: Variable Instantiation and Declaration in Java - Mr. M online

Comments are closed.