Asked by Mark
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
Answered by
MathMate
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.
There are no AI answers yet. The ability to request AI answers is coming soon!