subject
Computers and Technology, 12.08.2020 07:01 aj0914

A small company provided you three files. 1) emp. txt : this file contains 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 example emp. txt file.
2) dept. txt: 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 example dept. txt file.
3) query. txt: 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 then next n lines contains 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 example query. txt file.
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 total salary paid to that department. If the department does not exist, the total salary will be 0.
emp dept relationship: Employee and department is related by the employee id. An employ can have 0 or one department. For example, e5 Martin is not associated to any department. A department can have 0 or more employees.
Requirements:
1. Your program need to have at least two structures. One for employee and one for department. You need to use array of those structures.
2. int readEmp(Employee ArrayOfEmployees[]): You need to implement readEmp function with this function header. This function opens your emp. txt file and load the passed array to this function and returns number of employees in the file.
3. void readDept(Dept ArrayOfDepartments[], int *numOfDept): You need to implement readDept function with this function header. This function opens yourdept. txt file and load 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, 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 appropriate function(s).
Sample Input/Output: Use the input files. There is no console input involved in this program. The output of the code is based on the provided files
Printing the list of Employees:

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
ID: e5 LName: Martin Salary: 600 Department: None
ID: 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

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:50
Before you enter an intersection on a green light make sure
Answers: 2
question
Computers and Technology, 22.06.2019 03:00
You install teamviewer on your workstation at home so that you can ac ess it when on the road. how can you be assured that unknown users cant access your computer through team viewer?
Answers: 2
question
Computers and Technology, 23.06.2019 00:20
Ihave been given the number of guns per 100, and the total firearm-related deaths per 100,000. i have to find the actual number of guns per country and actual number of gun-related deaths. if somebody could show me how to do 1 question, i can finish the rest, i am just confused. tia
Answers: 3
question
Computers and Technology, 23.06.2019 16:50
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
You know the right answer?
A small company provided you three files. 1) emp. txt : this file contains list of employees where...
Questions