ELEC 372
Engineering Software Structures

Assignment 1: A Student Data Base



This assignment is to be performed individually. Informal discussions with classmates are acceptable; however, all design documents, code and other submitted work are to be your individual work.

Assignments are to be submitted in the ELEC 372 assignment drop box, located outside Goodwin 235, by Monday January 29 at 1:00 PM. A solution will be posted shortly after the assignments are collected, so we will not be able to accept late assignments. Note that printers often become backed up shortly before assignment submission deadlines - please take this into account in your planning.

A Student Data Base

In this assignment, you will complete the design and implementation of a student data base.  The data base is used to record information about students enrolled in the University of Seely's Bay (USB), a famed Canadian institution boasting the Golden Gusts football team, and hardy students capable of getting to class through meters deep snow, ice and slush.

The data base contains lists of all the courses offered by the university, the students enrolled at the university, and what courses each student is taking.

Format of the Data Base File

When the program starts, it reads in the contents of the data base from a file.  This file is of the form:
dbFile ::= { ugStudent }  { gradStudent } { course }
ugStudent ::= "ugStudent" "+" name "+" studentNumber
gradStudent ::= "gradStudent" "+" name "+" studentNumber "+" thesisTitle
course ::= "course" "+" title { "+" studentNumber }
That is, the file consists of lines describing undergraduate students, followed by lines describing graduate students, and finally lines describing courses.  For example, the following file:
ugStudent+Mick Jagger+123
ugStudent+Doris Day+124
gradStudent+Sarah McLachlan+132+How to Write Pop Songs
course+MATH100+123+124
states that Mick Jagger is an undergraduate student with student number 123, Doris Day is an undergraduate student with student number 124, and Sarah McLachlan is a graduate student with student number 132, who is working on a thesis called "How to Write Pop Songs."  MATH100 is a course, in which Mick Jagger (123) and Doris Day (124) are enrolled. Each token on a line is separated by a "+" symbol.

Blanks are considered to be part of tokens, so the line:

course +MATH100+123+124
which begins with the token "course " will lead to an error. The blank should be removed, giving:
course+MATH100+123+124


You can also consider a more complex example of a student data base file.

Enrolment Rules

One of the purposes of the data base is to determine that students have enrolled in courses according to the rules.  USB's enrollment rules are:
  1. The courses cisc121 and cisc124 are exclusions.  No student may be enrolled in both of these courses at the same time.
  2. Students may be enrolled in at most five courses at a time.
  3. Courses must have enrollment of at least three students.  Any course with lower enrollment is cancelled.

To Do

Your assignment is to reimplement the List abstract data type. The provided implementation is illustrated by the following diagram:

Two kinds of list are used in the program: a list of students and a list of courses. Two interfaces (StudentList and CourseList) are used to describe the operations of these lists. Since the lists have quite similar functionality, they are implemented from a common base class (ListImpl). This ListImpl class uses an array to represent the elements of the list.

In this assignment, you are to provide new implementations of the CourseList and StudentList interfaces that are based on a linked list representation instead of an array. You should not change the definitions of the CourseList or StudentList interfaces, or any other of the provided classes.

Finally, you are to provide a brief discussion comparing the advantages/disadvantages of the array vs linked list implementation of these lists.

Provided Code

The following code has been provided for this assignment.  All of these classes belong to the package studentDB.  This code may contain minor errors -- if you find errors, correct them, and document the correction in your final report.  You may not modify the interfaces of the provided classes.  That is, you may not change the parameters or types of the methods of these classes, or add new methods. You are to provided a class diagram in UML detailing your implementation.

To Hand In

  1. [25%] Your UML class diagram explaining your implementation of the CourseList and StudentList interfaces.
  2. [60%] Your new implementation of CourseList and StudentList.  Your discussion of the advantages/disadvantages of the two implementations.
  3. [0%] A description of any errors you found in the provided code, and listings of the modified classes.
  4. [15%] Testing of the StudentDB class. This should include tests of the sample file given above, and of tests of your own divising, showing all cases of errors. Each test run should include the input, output, and an explanation of what the test was intended to show.