Computers and Technology
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

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 19:30, sandersmakaylaovq5vu
Raveena is making a professional presentation for a newly launched product of her company. she wants to incorporate the following features in her presentation. a) to add serial numbers in each slide b) to add name of her company on top of each slide. c) to add the picture of her product on the second slide(the picture of her product is stored on her computer) write the commands/features of her presentation tool using which she can perform the above operations.
Answers: 2
image
Computers and Technology, 22.06.2019 08:00, wgdelgado
What is the first step in creating a maintenance ?
Answers: 2
image
Computers and Technology, 23.06.2019 02:00, vivian2020
Read this excerpt from helen keller’s autobiography, the story of my life. have you ever been at sea in a dense fog, when it seemed as if a tangible white darkness shut you in, and the great ship, tense and anxious, groped her way toward the shore with plummet and sounding-line, and you waited with beating heart for something to happen? i was like that ship before my education began, only i was without compass or sounding-line, and had no way of knowing how near the harbour was. "light! give me light! " was the wordless cry of my soul, and the light of love shone on me in that very hour. . the morning after my teacher came she led me into her room and gave me a doll. the little blind children at the perkins institution had sent it and laura bridgman had dressed it; but i did not know this until afterward. when i had played with it a little while, miss sullivan slowly spelled into my hand the word "d-o-l-l." i was at once interested in this finger play and tried to imitate it. when i finally succeeded in making the letters correctly i was flushed with childish pleasure and pride. running downstairs to my mother i held up my hand and made the letters for doll. i did not know that i was spelling a word or even that words existed; i was simply making my fingers go in monkey-like imitation. in the days that followed i learned to spell in this uncomprehending way a great many words, among them pin, hat, cup and a few verbs like sit, stand and walk. based on this excerpt, which words best describe helen keller?
Answers: 2
image
Computers and Technology, 23.06.2019 09:00, paulusl19
The first screen you see when you open word2016 what is called?
Answers: 1
Do you know the correct answer?
A small company provided you three files. 1) emp. txt : this file contains list of employees where...

Questions in other subjects:

Konu
Mathematics, 21.01.2021 03:40
Konu
Biology, 21.01.2021 03:40
Konu
Social Studies, 21.01.2021 03:40
Konu
Social Studies, 21.01.2021 03:40