Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // adds student to course
- public boolean addStudent(Student Student) {
- if (studentlist != null) {
- if (numStudents == MAXPERCLASS || numStudents >= studentlist.length) { // if we are at the max number of students allowed
- return false;
- } else { // else we need more students
- studentlist[numStudents] = Student; //adds student object to array of students
- numStudents++;// increase the number of students in class by 1
- return true;
- }
- } else { // no students yet
- studentlist[0] = Student;// adds first student
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment