Question
Pseudo code: Input a list of employee names and salaries, and determine the
mean (average) salary as well as the number of salaries above and
below the mean
mean (average) salary as well as the number of salaries above and
below the mean
Answers
I will show a brief pseudocode for you to expand on. You can post the improved version for discussions.
// data input
total <- 0
while(more employees)
{
input employee.name, employee.salary
total <- total+employee.salary
increment count
}
if count equals zero, quit
// calculate mean
mean <- total/count
// calculate above and below mean
highCount <- 0
equalCount <-0
lowCount <- 0
while(more employees)
{
compare employee.salary with mean and increment highCount, equalCount or lowCount according to the case
}
// Output
Print highCount, equalCount and lowCount.
// data input
total <- 0
while(more employees)
{
input employee.name, employee.salary
total <- total+employee.salary
increment count
}
if count equals zero, quit
// calculate mean
mean <- total/count
// calculate above and below mean
highCount <- 0
equalCount <-0
lowCount <- 0
while(more employees)
{
compare employee.salary with mean and increment highCount, equalCount or lowCount according to the case
}
// Output
Print highCount, equalCount and lowCount.
Related Questions
how can write a pseudo code and a flow charts to solve these?
1 to find the greatest common divis...
Week 3 - Expand Pseudo Code
The accounting office indicated the code must be able to handle overtim...
Using Flowchart and Pseudo Code and a single real example (trace), please solve the following proble...
write a pseudo code algorithm that will accept 20 numbers and finds their product
how to design a pseudo code
Write a pseudo code that allows a user to enter the names and phone numbers of up to 20 friends
write a pseudo code and then draw a flowchart to calculate tax deduction of employess salary >2000,...
Arrays in pseudo code
a pseudo code that will request for two numbers and it will compute the difference and product of th...
Write the pseudo code for a program that determines the shipping cost for an order based on the fol...