Write a task that will perform some of the functions performed by a simple employee database. The various functions will be laid out below.
Each record will consist of six attributes, one if with is the primary key. The primary key will be automatically assigned to a record when the record is created. The fields for the record are as follows:
ID: integer (automatically generated by program)
Last name: 20 character max
First Name: 20 character max
Social Security Number: 11 character max (include “-“)
The data should be stored in a randomly accessible file. There should be at least 20
records stored in the file.
The index function will be able to index the data on any given field in ascending or descending order. The Index function should prompt the user to enter the field to be indexed. In addition, they should indicate if they want to index in ascending or descending order. To complete this task the sorting should be done using merge sort, heap sort or quick sort. Also, when you are indexing, you should not move entire records.
The whole record should not be read in the program. Only the primary key and the
indexed field should be stored in the program’s memory.
The display function should list all of the records in order based on the last indexing. In addition, the field that was indexed last should be the first field listed for each record. If no indexing was performed before choosing the display function, then the records should be displayed in order based on the primary key.
The search feature should employ a search algorithm that performs at log base-2 or better. The search feature should prompt the user to enter a social security number. The program should print the record if one exists that matches the social security number, otherwise tell the user that the number is not in the system. If you are using the binary search method, I suggest you call the indexing method to sort the social security numbers
This feature allows the users to add a record to the file. In addition, it should automatically generate a primary key value for the record. The program should insure that the new record has a unique social security number and that the format of the number is entered correctly (xxx-xx-xxxx)
This function will just delete a record from the file.
The file should store the records as a random access file. This will allow the program to access individual records without having to read the whole database into memory.
The menu function should display all of the above mentioned choices. Each function should be associated with an integer value. The program should prompt the user to enter in all of the choices at once. Then, the choices will be placed in a queue to track the order of the requests and executed one after another.