Real Number and Average Salary

Only available on StudyMode
  • Download(s) : 75
  • Published : February 17, 2013
Open Document
Text Preview
e array

Associate Program Material

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.

Process
                   Display Program Title
                   Give instructions on the program                    Open file for interactive input (write)                    Prompt for Names and Salaries                    Check for negative numbers                    Check for sentinel value Loop until sentinel value is entered

Get running total for Sum
Get running total for Count
Write input values to file
Close file after input
Determine if count is equal or greater than 1
Calculate average salary
Display average salary
Prompt for input Response
Determine if user wants to continue
Open file for batch processing (read)
Loop for processing file
Read salary field
Gather running total for both count variables
When the loop reaches EOF close file
Display count variables as output
                  
          Input
                   Input Name (Name: String)                    Input Salary (Salary: Real)           Output
                   Display Average salary
                   Display Count_2 above average salary                    Display Count_3 below average salary

Pseudocode
Main Module
          Declare Name, Response As String
          Declare Sum, Salaries, Average As Real
Declare Count, Count_2, Count_3 As Integer
          Write “               Welcome to the Payroll Program             ”           Write “”
          Write “This programs intended use is for you to enter a list”           Write “   of Names and Salaries into a file and output the   ”           Write “    the average salary from the list that is inputted.  ...
tracking img