CIS 303

Final Project

 

DUE 12/13/99 - Final Project


The purpose of the project is to create a random access database of student records. Your program should then create the random file if it does not exist and prompt the user for data. Your program will assign the data fields to the members of a record structure and write each record to the new random access file. Alternatively, your program should be able to read data from a disk file and perform the above tasks. Here is an outline of the actions that your program should follow:

The structure format is:           char socSecNum[12]
                                                    char name[30]
                                                  int scores[5]

When a user wants to access the data, your program will read the database data into an array of structures. Once the array of structures has been created, two index arrays are to be generated using a sorting algorithm. One index is for the social security numbers and the other is for the names. Do not sort the array of structures. Your program should present the user with a menu of activities like the following.

C lass Grade Report
D isplay One Record
U pdate Scores
E xit Program

C - (Class Grade Report)

When the user chooses this option another choice is presented to the user to print the report in social security number or name order. Or, simply add another menu choice.

D - (Display One Record)

This option will ask the user to input either a SSN or a name. A search of the array of structures (using the appropriate index) will take place. The search will look for a matching SSN or name depending on the userâs choice. The names in the random file will be in last, first order. If a match is found all fields of the record will be displayed on the screen labeled appropriately. If no match is found an appropriate message will be displayed.

U - (Update Scores)

Only test score fields may be edited. The user may select the record by entering either the SSN or name. After editing the score(s) the record in the file must be rewritten. The record number is the same as the value in the index. The details of reading and writing a random access file using the functions fread, fwrite, and fseek will be discussed in class.

A - (Add a Record)

Fields for a new record are input by the user based on prompts from the program. Each new record is to be appended to the array of structures and appended to the random access file as soon as it is entered. Also all indexes must be updated immediately. Note: duplicate SSNs are not allowed..

E - (Exit Program)

This option terminates the program.

Make sure your data file is not in order by either social security numbers or names. Print a copy of your 20-record text data file to turn in along with a copy of your source code for the database program and enough screen prints to demonstrate all program requirements. For example, print the class report just before and just after changing some scores. Highlight the changes and be sure to label each screen print!