IUP Computer Science
CO 310 Spring 1993

Assignment #1a


    A student information data base is being formed.  Currently, there are only a small number of students represented in the data base.  However, more are expected to be added in the future (a few may be removed, as well). Your task is to write a program to handle the actions that need to be performed on this data base.   Among these actions are the following.

 1.  ADD a new student record.
 2.  DELETE a record currently in the data base.
 3.  FIND all the information about a student and display it (or display an error message if there is no such student).
 4.  LIST all information about all students (listing them in alphabetical order).
 5.  RANK the students based on their QPA and print the student's names out in the order of their rank.
    
    You will be writing three versions of the program to perform these tasks.  The first version of the program provides control for the overall program.  The program should begin by reading in information about the students into an array.  Then, the program should accept single-character commands from the terminal and call a procedure that performs the task associated with that command.  The commands and their tasks are A - ADD, D - DELETE, F - FIND, L - LIST, R - RANK and Q - QUIT.  For this last command, the program should terminate (no procedure is to be called).

    In this version of the program, you should write stubs for each of the procedures, except the LIST procedure (you must have a working LIST procedure in this version).  The other procedures will be filled out in later versions of the program.  The information about each student is stored in a record that has the following type.

    INFOREC = PACKED RECORD
                   NAME:     NAMESTRING;
                   QPA:      REAL;
                   NUMCRS:   INTEGER;
                   COURSES:  PACKED ARRAY [1..10] OF 0..4095;
              END;

where NAMESTRING is a packed array of up to 20 characters; NUMCRS is the number of courses the student is taking; and entries in the COURSES array are numeric codes for these courses.  The data base records are in the file P:STU93.DAT and are already in alphabetical order.  Copy the data to make your own STU93.DAT file; use your file as the data file for the program.

    When you run your program, at least give an L command before entering the Q to terminate the program.





IUP Computer Science
CO 310 Spring 1993

Assignment #1b


    For this second version of the student information program, you are to make the following changes to the first version of the program.

1. Allow the single-letter commands to be entered in either uppercase or lowercase.  That is, the LIST task should be performed if either L or l is entered.

2. Fill out the procedure to ADD a new student record.  Be sure to have the procedure get all the information for the new record from the person at the terminal.  The added record must be placed in the array so that the array remains in alphabetical order.

3. Fill out the procedure to DELETE a student record.  Ask the person at the terminal for the name of the student to be deleted.  Be sure to handle the case where the named student doesn't exist in the data base.  After the deleted record is gone, the records in the array should remain in alphabetical order (with no gaps).

4. Fill out the procedure to FIND a student record and display all the information about that one student.  Handle the terminal user and the "not-found" case as for DELETE.

    Suggestion:  Make an additional procedure to help you do the DELETE and FIND tasks.  This procedure would do the searching of the array of student records for a designated record.  Have the DELETE and FIND procedures call this searching procedure rather than put essentially the same statements in the two procedures.

    Demonstrate that the second version of the program works by running it and entering the following series of commands.   Capture the demonstration with CARBON and hand it in.
L
A    { add  Capp, Andy you make up the rest }
F    { find  Oop, Alley }
a    { add  Abner, Daisy Mae you make up the rest }
D    { delete  Canyon, Steve }
F    { find  Dallas, Steve }
f    { find  Capp, Andy }
d    { delete  Harris, Zonker }
A    { add  Palooka, Joe you make up the rest }
d    { delete  Bailey, Beetle }
F    { find  Worth, Mary }
L
Q





IUP Computer Science
CO 310 Spring 1993

Assignment #1c


For the final version of the student information program, you are to make the following changes to the second version of the program.

 1. Fill out the procedure to RANK the students based on their QPA and print out the students' names in the order of their rank.

To do this, your program must sort the students based on their QPAs.  You must do this sorting using a pointer or indirect sort.  That is, you are not allowed to change the order of the records in the data base array; nor are you allowed to make a duplicate of both the names and QPAs and sort the duplicates.  The only information that you are allowed to duplicate for this sorting are the QPAs; and the duplicated QPAs must be in local storage so that the space is reclaimed after the program returns from the RANK procedure.  Note:  the ranking can be done without duplicating any information from the student records.

 2. After the Q command is entered and before terminating the program, write out the updated version of the student data base to a file called STU93.NEW.  The output records for STU93.NEW must be in exactly the same form as the original records.

Demonstrate that the final version of the program works by running it and entering a set of commands similar to those used to demonstrate the second version.  However, you must include one or more R commands in the set, preferably two such commands (one near the beginning and another near the end).

After the program terminates, do DUMP/RECORD/OUTPUT=RAW.NEW of the STU93.NEW file. Then, print the RAW.NEW file.  DO NOT ATTEMPT TO PRINT STU93.DAT OR STU93.NEW UNDER ANY CIRCUMSTANCES.  Don't be concerned that nothing but the names seem to be readable when you do this DUMP; the names and associated gibberish will be just fine.

Handin the program listing, evidence that RANK works and the DUMP of the STU93.NEW file.