![]() |
ELEC
372
|
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.
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.
dbFile ::= { ugStudent } { gradStudent } { course }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 ::= "ugStudent" "+" name "+" studentNumber
gradStudent ::= "gradStudent" "+" name "+" studentNumber "+" thesisTitle
course ::= "course" "+" title { "+" studentNumber }
ugStudent+Mick Jagger+123states 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.
ugStudent+Doris Day+124
gradStudent+Sarah McLachlan+132+How to Write Pop Songs
course+MATH100+123+124
Blanks are considered to be part of tokens, so the line:
course +MATH100+123+124which 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.
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.