1	// EnrollCommand.java
     2	//
     3	// For final project, cs110. 
     4	// Based on Juno shell command.
     5	// Ethan Bolker  Spring 2004
     6	
     7	import java.util.*;
     8	
     9	/**
    10	 * The WISE command to enroll a student in a course
    11	 * Usage:
    12	 * <pre>
    13	 *     enroll student[name|id] course
    14	 * </pre>
    15	
    16	 */
    17	public class EnrollCommand extends WISECommand 
    18	{
    19	    /**
    20	     * Enroll a student in a course.
    21	     *
    22	     * @param args the remainder of the command line.
    23	     * @param wise the current WISE.
    24	     *
    25	     * @exception WISEException for reporting errors
    26	     */
    27	    public void doIt( StringTokenizer args, WISE wise )
    28		 throws WISEException  
    29	    {
    30		try {
    31		    String studentName = args.nextToken();
    32		    String courseName  = args.nextToken();
    33		    Student student    = wise.getStudent(studentName);
    34		    Course course      = wise.getCourse(courseName);
    35		    student.add(course);
    36		}
    37		catch( NoSuchElementException e ) {
    38		    throw new WISEException( "usage: enroll studentName|ID course" );
    39		}
    40	    }
    41	}