Microsoft Word - A3.docxAssignment 3: profile Weighting: 9%1.0 Introduction Every company, looks for solutions to keep their employee records organized. The project, proFile, is a dynamic...

1 answer below »
PFA


Microsoft Word - A3.docx Assignment 3: profile Weighting: 9% 1.0 Introduction Every company, looks for solutions to keep their employee records organized. The project, proFile, is a dynamic linked list implementation in C programming that utilizes employee information stored in a struct. The program must provide a flexible and efficient way to allow users to easily add, edit, and remove employee information as needed. 2.0 The Task With its user-friendly interface and robust functionality, proFile will be an ideal tool for companies looking to streamline their employee management processes. Via a menu-driven solution, create a program that allows a user to run basic tasks on employee data, tasks such as add an employee to the current linked list (LL), display employee data, search employees based on a given criteria, find how many employees exist currently and so on. The menu will be command-line based and will have the following options: 1. Add a new employee 2. Print data of all employees 3. Print data of the nth employee 4. Search for employee based on empId 5. Search for employee based on full name 6. Count the total number of employees 7. Sort the employees based on their empId 8. Remove the nth employee in the current LL 9. Remove all employees in the current LL 10. Exit After the completed execution of each of the menu options (except for the Exit option), the user should be brought back to the menu and re-prompted to enter a new command. Header file is provided as headerA3.h. The required files that you have to create are: 1. Implementation files: one for each function – file name must be the same as function name. Note that this is a new requirement – was not a part of A1 or A2. (see section 4 for more details) 2. Testing file: name it mainA3.c 3. A makefile: Your program will be compiled using a makefile with the following flags: -std=c99 -Wall Note that grading will be based on the specified function definitions. You are encouraged to make a robust testing file (mainA3.c ) containing a main(). 4. Requirement on the folder structure of source, header and executable files – read Section 4.0.2 for details. 3.0 Technical Components While it is likely that companies use a much more efficient means of storing their data, one of the most basic structures to hold an endless set of data is a linked list. In this assignment, we will create a linked list to store the data for all employees that we create, edit, delete, search, load and save. The linked list will rely on a user-defined structure and will follow this structure definition for it: /* definition of an employee record*/ struct employee { char fname[MAX_LENGTH]; char lname[MAX_LENGTH]; int empId; // this is auto-generated by the program char ** dependents; // this array is dynamically allocated int numDependents; struct employee * nextEmployee; }; MAX_LENGTH is defined as 25 in the header file. For simplicity, assume that members fname and lname are statically allocated. However, since number of dependents may be different for different employees, dependents is a dynamically allocated 2D string that stores the names of dependents of an employee. It is assumed that name of a dependent will be less than MAX_LENGTH characters (similar to fname and lname of employees). Member *nextEmployee is a pointer that will be used to create and link the nodes in the linked list. This pointer will be used to hold the memory address for the next employee. You must write a separate function for each menu option (except the exit option 10). Each function should be contained in its own function file. You must create a main (mainA3.c) that displays the menu and executes the menu options based on user choice. All function prototypes are given in a file called headerA3.h. Besides these functions, you may create other functions and store them in a separate file called helperA3.c. A helperA3.c file is provided to you with a load function called loadEmpData that allows you to load 4 employee data and adds them to a linked list. It is safe for you to assume that the empIds added using this function are unique. You may start your program by calling this function and adding employees to a linked list. Menu Option 1: Add a new employee This option calls function named recruitEmployee that allows the user to manually enter the employee data from standard input and add their information to the end of the linked list passed as a parameter to this function. The user enters the fname, lname of the employee. It then prompts to enter the dependent names one by one as shown below. Note that empId is unique for every employee and is automatically generated by the program (rule given below). Choose a menu option: 1 Enter the first name of the employee: Ritu Enter the last name of the employee: Chaturvedi Enter name of dependent# 1: Macy Do you have any more dependents? y Enter name of dependent# 2: Hiro Do you have any more dependents? Y Enter name of dependent# 3: Alphie Do you have any more dependents? n You have 3 dependents. Your computer-generated empId is 430 Note that empId is automatically generated using the following rule: empId = (sum of ascii values of characters in the first name) + (length of the employee’s last name). For example, for the sample given above, the generated empId = (82 + 105 + 116 + 117) + 10 = 430. If this empId already exists in the current linked list, then add random numbers between 1 and 999, repeatedly, until a unique empId is generated. This function must store new employee data at the end of the current linked list. /*\Note: Use the prototype given in headerA3.h Menu Option 2: Print data of all employees If option 2 is selected, a function called printAll is called. This function prints the data of all employees currently in the LL. For example, if there are 2 employees in the current LL: Choose a menu option: 2 Employee # 1: Employee id: 430 First name: Ritu Last name: Chaturvedi Dependents [3]: Macy, Hiro, Alphie Employee # 2: Employee id: 384 First name: Jeff Last name: David Dependents [2]: Vicki, Daisy Currently, there are 2 employees. /*\Note: Use the prototype given in headerA3.h Menu Option 3: Print employee data at position n in the LL If option 3 is selected, a function called printOne is called. This function takes a sequence number (i.e., an int) as input and prints the data of the employee at that position in the current LL. Assume that the head of the linked list is at position 1. For example: if there are 2 employees in the current LL as shown in menu option 2, and the position entered is 2, Choose a menu option: 3 Enter a position: 2 Employee id: 384 First name: Jeff Last name: David Dependents: Vicki, Daisy Menu Option 4: View employee data based on empId If option 4 is selected, a function called lookOnId is called to do the following: given as input, an empId, it searches the current LL using the given empId, and returns the position of this employee in the current LL. For example, position for empId 430 in the current LL is returned. When printed in main, following information is printed. (Note that the function does not print this information – it only returns the position of the employee’s data in the LL): Choose a menu option: 4 Enter an employee ID: 430 Employee id: 430 First name: Ritu Last name: Chaturvedi Dependents: Macy, Hiro and Alphie /*\Note: Use the prototype given in headerA3.h Menu Option 5: View employee data based on full name If option 5 is selected, a function called lookOnFullName is called to do the following: given as input, the full name of the employee, it searches the current LL, and returns the position of this employee in the current LL. For example, if the given full name is “Ritu Chaturvedi” (without including the quotes), the position of this employee in the current LL is returned. When printed in main, following information is printed. (Note that the function does not print this information – it only returns the position of the employee’s data in the LL): Choose a menu option: 5 Enter the full name of the employee: Ritu Chaturvedi Employee id: 430 First name: Ritu Last name: Chaturvedi Dependents: Macy, Hiro and Alphie Assume that the full name of an employee consists of the first name followed by one or more spaces followed by last name of the employee (i.e., no middle name). /*\Note: Use the prototype given in headerA3.h Menu Option 6: Count number of employees Call function countEmployees for this option For example (black is system text, red is user input): Choose a menu option: 6 Total number of employees = 4 /*\Note: Use the prototype given in headerA3.h Menu Option 7: Sort employee data in ascending order of empId Call function sortEmployeesId for this option For example (black is system text, red is user input): Choose a menu option: 7 After sorting on empId, the employees are as follows: Employee # 1: Employee id: 384 First name: Jeff Last name: David Dependents [2]: Vicki, Daisy Employee # 2: Employee id: 430 First name: Ritu Last name: Chaturvedi Dependents [3]: Macy, Hiro, Alphie /*\Note: Use the prototype given in headerA3.h Menu Option 8: Fire the nth employee In this option, a function called fireOne is called. The user is prompted to give a value between 1 and the total number of employees in the current LL. For example: Choose a menu option: 8 Currently there are 5 employees. Which employee do you wish to fire – enter a value between 1 and 5: 2 Employee [Id: 384] fired. There are now 4 employees. /*\Note: Use the prototype given in headerA3.h Menu Option 9: Fire all employees In this option, a function called fireAll is called. This function removes all employees from the current LL. Choose a menu option: 9 Are you sure you want to fire everyone: y All fired. Linked list is now empty. /*\Note: Use the prototype given in headerA3.h 4.0.1 Files required: • All nine function implementation files. You must submit these. • headerA3.h — this file is given to you with the function definitions/prototypes, constants, library imports. You must add your student info, and declaration of academic integrity to this file. You must submit this. • mainA3.c — your testing file/driver program used to verify outputs/test your functions. This file would contain a main(). You must submit this. • helperA3.c - this file is given to you with a load function and an additional function – both required to load a few employee records from
Answered 19 days AfterMar 12, 2023

Answer To: Microsoft Word - A3.docxAssignment 3: profile Weighting: 9%1.0 Introduction Every...

Vikas answered on Mar 23 2023
31 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here