English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

input a list of employee names and salaries
determine the mean (average) salary as well as the number of salaries above and below the mean.

could someone set this up for me with an example???
im not sure where to begin..and i need to pass this class!!

2007-05-04 06:54:27 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

i forgot...could you write the pseudocode also!! thanks.

2007-05-04 07:09:45 · update #1

2 answers

in which language?
C, PASCAL, C++ or JAVA?
send me your answer with your question to
iyiogrenci@yahoo.com

2007-05-04 07:10:34 · answer #1 · answered by iyiogrenci 6 · 0 0

C++

const int SIZE = 10;
string employee_name[SIZE];
float employee_salary[SIZE];

float sum = 0;

for (int i = 0; i < SIZE; i++ {
cin >> employee_name[i] >> employee_salary[i]
sum += employee_salary[i];
} // end for

float mean = sum / SIZE;
int aboveMean = 0;
int belowMean = 0;
for (int i = 0; i < SIZE; i++) {
if (employee_salary[i] < mean) { belowMean++; }
else {aboveMean++;}
} // end for

cout << "Mean: " << mean << "\n# salaries above mean: " << aboveMean << "\n# salaries below mean: " << belowMean << "\n";

2007-05-04 16:10:35 · answer #2 · answered by deque 2 · 0 0

fedest.com, questions and answers