IT 210 Week 5-Checkpoint - Simple Array Process

IT 210 Week 5-Checkpoint - Simple Array Process -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
IT/210 CheckPoint: Simple Array Process Chapter 6 / Exercise 3 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. Define n to store number of employees Output “Enter the number of employees:” Input n Define namearray[n] Define salaryarray[n] Define sum_salary to store running sum of salaries Set sum_salary = 0 Define loop_integer Set loop_integer = 1 While (loop_integer – 1 < n) Output “Enter the name of employee” loop_integer Input namearray[loop_integer – 1] Output “Enter the salary of employee” loop_integer Input salaryarray[loop_integer – 1] Add salaryarray[loop_integer – 1] to sum_salary Increase loop_integer by 1 End while Define mean_salary to store mean salary of employees
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: mean_salary = sum_salary / n Output The mean salary is mean_salary Define count_below to store the number of salaries below the mean salary Set count_below = 0 IT/210 CheckPoint: Simple Array Process Define count_above to store the number of salaries above the mean salary Set count_above = 0 Set loop_integer = 1 While (loop_integer 1 &lt; n) If (salaryarray[loop_integer 1] &lt; mean_salary) Increase count_below by 1 Else if (salaryarray[loop_integer 1] &gt; mean_salary) Increase count_above by 1 End if End while Output The number of salaries below the mean salary is count_below Output The number of salaries above the mean salary is count_above...
View Full Document

This note was uploaded on 01/25/2011 for the course IT 210 taught by Professor Josephpillera during the Spring '10 term at University of Phoenix.

Page1 / 2

IT 210 Week 5-Checkpoint - Simple Array Process -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online