controller
Class Controller

java.lang.Object
  extended by controller.Controller
All Implemented Interfaces:
RegController

public class Controller
extends java.lang.Object
implements RegController

This class serves as the main program for the UML Implementation labs in CS211


Constructor Summary
Controller()
          Constructor for controller
 
Method Summary
 void doDrop(java.lang.String courseId, java.lang.String studentName)
          Drop a specified student from a specified course
 void doEnroll(java.lang.String courseId, java.lang.String studentName)
          Enroll specified student in specified course
 void doGrade(java.lang.String courseId, java.lang.String studentName, java.lang.String grade)
          Set grade for specified student in specified course
 void doReportAllCourses()
          Print a report for all courses
 void doReportAllStudents()
          Print a report for all students
 void doReportCourse(java.lang.String courseId)
          Print a report for a specific course
 void doReportStudent(java.lang.String name)
          Print a report for a specific student
 java.util.Iterator getCourseIds()
          Get the course id's of all courses
 java.util.Iterator getStudentNames()
          Get the names of all students
static void main(java.lang.String[] args)
          Main program
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controller

public Controller()
Constructor for controller

Method Detail

main

public static void main(java.lang.String[] args)
Main program


getCourseIds

public java.util.Iterator getCourseIds()
Get the course id's of all courses

Specified by:
getCourseIds in interface RegController
Returns:
an Iterator that gives access to all the course id's

getStudentNames

public java.util.Iterator getStudentNames()
Get the names of all students

Specified by:
getStudentNames in interface RegController
Returns:
an Iterator that gives access to all the student names

doEnroll

public void doEnroll(java.lang.String courseId,
                     java.lang.String studentName)
              throws java.lang.IllegalArgumentException
Enroll specified student in specified course

Specified by:
doEnroll in interface RegController
Parameters:
courseId - id of the course
studentName - the name of the student
Throws:
java.lang.IllegalArgumentException - if either parameter is invalid, if student is already in (or waiting for the course) or if there is no room in the course. (In the latter case, the student is added to the waiting list for the course.)

doDrop

public void doDrop(java.lang.String courseId,
                   java.lang.String studentName)
            throws java.lang.IllegalArgumentException
Drop a specified student from a specified course

Specified by:
doDrop in interface RegController
Parameters:
courseId - id of the course
studentName - the name of the student
Throws:
java.lang.IllegalArgumentException - if either parameter is invalid, or the student is not in the course. A student can be removed either from the course itself, or from its waiting list. If a student is dropped from the course, the first student on the waiting list (if any) is enrolled in his/her place.

doGrade

public void doGrade(java.lang.String courseId,
                    java.lang.String studentName,
                    java.lang.String grade)
             throws java.lang.IllegalArgumentException
Set grade for specified student in specified course

Specified by:
doGrade in interface RegController
Parameters:
courseId - id of the course
studentName - the name of the student
grade - the grade to assign
Throws:
java.lang.IllegalArgumentException - if any parameter is invalid, or if the student is not actually enrolled in the course

doReportAllCourses

public void doReportAllCourses()
Print a report for all courses

Specified by:
doReportAllCourses in interface RegController

doReportCourse

public void doReportCourse(java.lang.String courseId)
                    throws java.lang.IllegalArgumentException
Print a report for a specific course

Specified by:
doReportCourse in interface RegController
Parameters:
courseId - the ID of the course to print a report for
Throws:
java.lang.IllegalArgumentException - if the parameter is invalid

doReportAllStudents

public void doReportAllStudents()
Print a report for all students

Specified by:
doReportAllStudents in interface RegController

doReportStudent

public void doReportStudent(java.lang.String name)
                     throws java.lang.IllegalArgumentException
Print a report for a specific student

Specified by:
doReportStudent in interface RegController
Parameters:
name - the nameof the student to print a report for
Throws:
java.lang.IllegalArgumentException - if the parameter is invalid