IUP Computer Science
CO 310 Spring 1986
Project #4
For this project, you will use the same data file as for
project #1, i.e., the STUDENTS.COMPSCI file. You will recall
that each record in this file contains a student name, QPA for
the student, number of courses, and an array of course numbers -
see project #1 for the record definition. The file contains the
student names in alphabetical order; however, the course numbers
for a student are in no particular order at all.
Project #4 begins by having your program read in the records
of the STUDENTS.COMPSCI file and forming a complex linked list.
For each student record, form a node containing name, QPA,
pointer to next student list node, number of courses, and a
pointer to a course list. The course list should contain nodes
which hold a course number and a pointer to the next course list
node. The student record list must keep the students in alphabetical order and each course number list must keep the courses
in the same order as they are in the array.
After the student record and course lists have been formed,
the program must interactively perform two actions (based on one-letter or one-word commands).
Add Allow a student to add a course. The program
should prompt for the student name and the course
number to be added. The program must handle the
error conditions (1) no such student in list and
(2) student already has the course. Added courses
go at the end of the course list.
Drop Allow the student to drop a course. The program
should prompt for the student name and the course
number to be dropped. The program must handle the
error conditions (1) no such student in list and
(2) no such course for this student.
For either action, the number of courses in the student list node
must be updated. If the action specified is anything but Add or
Drop, the program should display the contents of the list
structure, much like the LIST command from project #1, and then
terminate. You should NOT write the revised student information
back to the STUDENTS file.
Your program will be expected to use GETNODE and RETNODE
procedures to deal with course list nodes. However, the program
need not use such procedures for student nodes. The lists that
you use in the program may use header nodes, may be circular, and
may be doubly linked (if you wish) or may use none of these. The
program documentation should clearly state what kind of lists you
are using. A specific set of Add/Drop commands to use in the
final run of your program will be given later.