question archive Problem: Employee management A small company provided you three files
Subject:Computer SciencePrice: Bought3
Problem: Employee management A small company provided you three files. 1) One employee details file: this file contains a list of employees where each line represents data of an employee. An employee has an id (String max length 20), last name (string max length 100), and salary (int). See the sample emp1.txt and emp2.txt files on codegrade template. Your code wil just read one employee file based on the file name provided as a user input. 2) One employee department file: This text file contains list of departments of the employees. Each line of the file contains an employee id (string max length 20) and department name for that employee (string max length 100). See the sample dept1.txt and dept2.txt files on codegrade template. Your code will just read one dept file based on the file name provided as a user input. 3) Query file: This file contains a set of queries. There can be two types of queries. Query type 1 represents searching for an employee and Query type 2 presents searching for a department. The first line of the file contains the number of queries n and the next n lines contain the queries. The first number of each line represents the type of query and the second string in the line represents the query key. See the sample query1.txt and query 2.txt files on codegrade template. Your code will just read one dept file based on the file name provided as a user input. Example Query: A query line "1 Smith" will search for Smith and will display details of Smith including his department name. If Smith does not exist, your program should display "Employee Smith Not Found" A query line "2 Clinical" will search for Clinical department and will display the total salary paid to that department. If the department does not exist, the total salary will be O. emp dept relationship: Employee and department are related by the employee id. An employee can have O or one department. For example, e5 Martin in the sample file is not associated with any department. A department can have 0 or more employees. Requirements: 1. Your program needs to have at least two structures. One for employee (Structure name should be Employee) and one for department (Structure name should be Dept). You need to use array of those structures. 2. int readEmp(Employee ArrayOfEmployees, char empFileName): You need to implement readEmp function with this function header. This function opens your employee file based on the file name passed to the parameter and loads the passed array to this function and returns number of employees in the file. 3. void readDept(Dept ArrayOfDepartments, int *numOfDept, char depetFileName): You need to implement readDept function with this function header. This function opens the file name passed to the parameter and loads the passed array to this function and also update the referenced variable with the number of department in the file. 4. void printAll(Employee Arr, int totalEmp, Dept ArrayOfDepartments, int totalDept): This function prints the details of all the employees including their department name available in the passed arrays. See the output format from the sample output shown bellow. 5. void search_employee(Employee Arr, int totalEmp, Dept ArrayOfDepartments, int totalDept, char qStr): This function processes query type 1 and produces output like the sample output. 6. int totalSal_dept(Employee Arr, int totalEmp, Dept ArrayOfDepartments, int totalDept, char qStr) : This function processes the query type 2 and produces the output like the sample output. 7. In the main function, first read three file names (the file names will be single word strings with max length 50. the first one is the employee file, the second one is the dept file and the third one will be the query file), declare necessary variables and call the load functions first and then call the printAll function. Next, start reading the query file and process the queries by calling the appropriate function(s). Sample Input/Output1: //input: emp 1.txt dept1.txt query1.txt //Output. The output of the code is based on the provided emp1.txt, dept1.txt, and query1.txt file Printing the list of Employees: =2== ID: e1 LName: Adam Salary: 500 Department: Finance ID: e2 LName: Smith Salary: 700 Department: Sales ID: e3 LName: Robin Salary: 450 Department: Marketing ID: e4 LName: Jack Salary: 800 Department: Sales D: e5 LName: Martin Salary: 600 Department: None D: e6 LName: Nusair Salary: 700 Department: IT Query Phase ID: e2 LName: Smith Salary: 700 Department: Sales Total Salary of Department Clinical is 0 Employee Nasir Not Found Total Salary of Department Sales is 1500 Rubric: Total 2 points. (Hardcoding any data from the file to match the output will result in O in all assignments) [for example printf("Adam")... is an example of hardcoding if(stremp(x, "Adam") is a hardcoding as you took this name from the file. The file can be different and in that case this code is not valid) Writing each function based on the exact specification: 0.33 points (total 6 functions) Not exactly matching the test case: -1.5 penalty Bad indented and poorly written code penalty: -1 Note that just passing test cases is not enough to get full credit if you do not fulfill the requirements
C language
There is no additional information related to the question.
It is an assignment, not any quizzes or test.