|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object model.Course
public class Course
Representation for a single course
Constructor Summary | |
---|---|
Course(java.lang.String id,
int limit)
Constructor |
Method Summary | |
---|---|
void |
addEnrolledIn(java.lang.String studentName,
EnrolledIn newEnrolledIn)
Add a new enrollment to the course |
void |
addWaiting(Student student)
Add a student to the waiting list for a course |
boolean |
areAnyWaiting()
Test to see whether any students are waiting to get into the course |
EnrolledIn |
getEnrolledIn(java.lang.String studentName)
Accessor for the enrollment for a specific student |
int |
getEnrollmentCount()
Accessor for the number of current enrollments in the course |
java.lang.String |
getId()
Accessor for the course's id |
int |
getLimit()
Accessor for the enrollment limit |
boolean |
isEnrolledIn(java.lang.String studentName)
Determine if a specific student is enrolled in the course |
void |
printReport()
Print a report on the course - enrollments and waiting list |
void |
removeEnrolledIn(java.lang.String studentName)
Remove the enrollment for a specific student |
Student |
removeFirstWaiting()
Remove the first student from the waiting list when a slot opens up |
void |
removeWaiting(Student student)
Remove a specific student from the waiting list |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Course(java.lang.String id, int limit)
id
- the course's idlimit
- its enrollment limitMethod Detail |
---|
public java.lang.String getId()
public int getLimit()
public int getEnrollmentCount()
public void addEnrolledIn(java.lang.String studentName, EnrolledIn newEnrolledIn) throws java.lang.IllegalArgumentException
studentName
- the name of the student being enrollednewEnrolledIn
- the new enrollment to add
java.lang.IllegalArgumentException
- if the student is already enrolled in this coursepublic boolean isEnrolledIn(java.lang.String studentName)
studentName
- the name of the student
public EnrolledIn getEnrolledIn(java.lang.String studentName) throws java.lang.IllegalArgumentException
studentName
- the student's name
java.lang.IllegalArgumentException
- if the student is not enrolledpublic void removeEnrolledIn(java.lang.String studentName) throws java.lang.IllegalArgumentException
studentName
- the student's name
java.lang.IllegalArgumentException
- if the student is not enrolledpublic void addWaiting(Student student) throws java.lang.IllegalArgumentException
student
- the student to add
java.lang.IllegalArgumentException
- if the student is already in the course or on the waiting listpublic void removeWaiting(Student student) throws java.lang.IllegalArgumentException
student
- the student to remove
java.lang.IllegalArgumentException
- if the student is not on the waiting listpublic boolean areAnyWaiting()
public Student removeFirstWaiting()
public void printReport()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |