Question
Write a task in C++ that will perform some of the functions performed by a simple employee database. The various functions will be laid out
Write a task in C++ that will perform some of the functions performed by a simple employee database. The various functions will be laid out below. Data: 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 -) Salary: float Age: integer The data should be stored in a randomly accessible file. There should be at least 20 records stored in the file. Index: 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 programs memory. Display: 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. Search: 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 Add Record: 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) Delete Record: This function will just delete a record from the file. 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. Menu: The menu function should display all of the abovementioned 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started