Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I asked this question before but the solution posted is not exactly what I was l

ID: 3766634 • Letter: I

Question

I asked this question before but the solution posted is not exactly what I was looking for. That link is below

https://www.chegg.com/homework-help/questions-and-answers/need-simple-pseudocode-example-https-wwwcheggcom-homework-help-questions-answers-solution--q9434461

I have attached example problems to give you an idea on what I am looking for on this link below

https://www.mediafire.com/folder/fasq7jv8nv5w58y,synekievgpu990v,synekievgpu990v,aa68hg17984us99,9e659oc37qgome7,pri82ilpmczpggq/shared

Explanation / Answer

I am assuming input is given in a form in which one line of file contains department number and then space and then no of employees

Steps

1. Create two arrays naming department and employees

2. Open file in read mode to read data and using while loop till end of file read file line by line

Above pointsre common for every module so will be done only one time

q1. Steps:

1.read first value in department array at index 'i' and second value in employee array at index 'i' and increase 'i' everytime

like while(!EOF)

{

cin>>department[i]>>employee[i]

i++

}

Q2: now iterate using foor loop till length of array as length of both array will be same. and print both array index wise like

for(i=0;i<department.length;i++)

{

cout<<"No of employees working in"<<department[i]<<"are"<<employees[i];

}

Q3: search in employee array for every value whether its value is less than 25 and if found make a not of its index and print value at that index in employee and department array.

for(i=0;i<employee.length;i++)

{ if(employee[i]<25)

cout<<department[i]<<" "<<employees[i];

}

4. iterate over employees array and add all the value in array and divide the total by array length

sum=0;

for(i=0;i<employee.length;i++)

{

sum=sum+employee[i];

cout<<sum/employee.length;

}

q5: It is slight different from q3 in a way that in q3 we need to give all department names but in this question we need to give only first department name whose employess are less than 25.

for(i=0;i<employee.length;i++)

{ if(employee[i]<25)

cout<<department[i]<<" "<<employees[i];

break; // Please note this "break" statement there. when it finds first department name break statement terminated the loop inside which we use the break statement.

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote