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, 22.06.2019 17:30
Ou listened to a song on your computer. did you use hardware or software?
Answers: 2
question
Computers and Technology, 23.06.2019 10:30
Would a ps4 wired controller work on an xbox one
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the can apple do to fix this issue?
Answers: 1
question
Computers and Technology, 23.06.2019 18:40
Johnson enterprises uses a computer to handle its sales invoices. lately, business has been so good that it takes an extra 3 hours per night, plus every third saturday, to keep up with the volume of sales invoices. management is considering updating its computer with a faster model that would eliminate all of the overtime processing.
Answers: 2
You know the right answer?
A small company provided you three files. 1) emp. txt : this file contains list of employees where...
Questions
question
Mathematics, 13.01.2020 20:31
Questions on the website: 13722363