chriscct1

Untitled

Nov 18th, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. // adds student to course
  2.     public boolean addStudent(Student Student) {
  3.                if (studentlist != null) {
  4.                         if (numStudents == MAXPERCLASS || numStudents >= studentlist.length) { // if we are at the max number of students allowed
  5.                                 return false;
  6.                         } else { // else we need more students
  7.                                 studentlist[numStudents] = Student; //adds student object to array of students
  8.                                 numStudents++;// increase the number of students in class by 1
  9.                                 return true;
  10.                         }
  11.                 } else { // no students yet
  12.                         studentlist[0] = Student;// adds first student
  13.                         return true;
  14.                 }
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment