CPSC170 Spring 2005
Program 4: Registration

It's time to sign up for classes for next semester! Write a program that handles this as described below.

Input

Your program should take two pieces of input at the command line: a filename and an integer. The file should contain a list of student schedules in the format below, where a schedule is a student followed by the courses that student wants to enroll in, with schedules separated by blank lines. The integer represents the capacity of each course (they all have the same capacity). A sample schedule file is given below:
Joe Smith
HIST 150
PSYC 101
SPAN 101
GST 101

Mary Jones
GST 101
SPAN 101
CPSC 120
CPSC 120L
PSYC 101

Chris Conner
SPAN 101
HIST 150

Sue Brown
SPAN 101
GST 101
You may assume that student names are always First Last. A student schedule must contain at least one course.

Output

Your program should output an alphabetical list of the courses offered with each course followed by a) an alphabetical list (by last name) of the students enrolled in each course, and b) a list of the students on the waiting list for each course, if there is a waiting list. The students on the waiting list should be given in the order in which they requested the course, not alphabetically. So if the capacity of each course is 2, the output for the data above should look like this:
CPSC 120
Mary Jones
------------
CPSC 120L
Mary Jones
------------
GST 101
Mary Jones 
Joe Smith

WAITLIST
Sue Brown
------------
HIST 150
Chris Conner
Joe Smith
------------
PSYC 101
Mary Jones
Joe Smith
------------
SPAN 101
Mary Jones
Joe Smith

WAITLIST
Chris Conner
Sue Brown
------------

Program Structure

You will need a Course class that holds the name of the course, its capacity, the number of students already enrolled, a list of those students, and a list of students waiting to add the course if it is full. You should use an OrderedList to hold the list of students (see Ch 8 in the text) and a queue to hold the waiting list. You will also need an ordered list to hold the courses themselves. You must use a linked implementation for the list. You may use whatever implementation you like for the queue.