Melissa Bean
IT/210
June 15, 2012
Dr. Bruce Huang
Checkpoint: Simple Array Process
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. 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.
Analysis
Process:
1. Prompt user to enter positive numbers between 1-100 into array 2. Prompt user to enter 0 when done 3. Prompt program to not store 0 4. List numbers using bubble sort 5. List first number as smallest 6. List last number as largest 7. List results
Input:
Prompt for Numbers (integer: numbers 1-100)
Output:
Smallest Number (integer: number 1-100) Largest Number (integer: number 1-100)
Design
Main Module
Declare Employee Names [100] as string Declare Salaries [100] as string Declare Average as real Declare K as integer Declare Sum as integer Write, “The Average Salary Computation Program.” Write, “This program enables the user to compute the average salary,” “of an employee and the number of salaries above and below that average.” Call Input Data Module Call Average Salary Module Call Salaries Above and Below Average Module Call Print Results Module End Program
End Main Module
Input Data Module
Write, “Type the name of an employee followed by the salary of this employee.” Input Employee Name and Salary Write, “Enter, 0 when done with program.” Set Sum = 0 Set K = 1 While Names [K] Input Names [K] Input Salaries [K] Set Sum = Sum + Salaries [K] Set K = K + 1 End While Call Average Salary Module
End Input Data Module
Average Salary Module
Set Average = Sum / K Write “You have “, K, “Employees.” “Their total salary is,” Sum Write “The average