Psuedocode
I am trying to write an array process for employee names and their salaries, and I also have to determine the mean salary and as well as the number of salaries above and below the mean. Can someone tell me if I am this simple array process I have written is correct
Here is my psuedocode
This program will allow a user to input an employee name and salary
The output will contain the mean salary as well as the number of salaries above and below the mean
As well as the number of salaries above and below the mean
//Arrays used:
// Name (K) = Array for employees names
//Salary (K) = Array of salaries
//
//Variables used:
//Mean = Mean of all employees Salaries
//Upmean = Number of employees making more than the mean
//Downmean = Number of employees making less than the mean
//Sum = Sum of all salaries
//Countm = Counter of mean
//Countup = Counter for all numbers of salaries above mean
//Countdown = Counter for all numbers of salaries below the mean
Main:
Call welcome message
Call input data
Call Calculate
Call output data
End
Write, “Welcome message”
Write, “beginning of salary program”
End
Input data
Declare name (100) of strings
Declare Salary (100) of real
Declare mean, upmean, downmean as real
Set sum = 0
Set Countm = 0
Set Countup = 0
Set Countdown= 0
Write, “Enter employee name and salary”
Write, “Enter 0 when done”
Input Name (K), Salary (K)
While Name < >
Set Countm = Countm + 1
Set sum = Sum + salary
Write, “Enter employee name and salary
Write, “Enter 0 when done“
Input Name (K), Salary (K)
End Input Data
Calculate
//Here is mean found
Set mean = Sum / Countm
// Here number of employees making more than the mean is found
For K Step to CountM
If Salary (K) > “Mean Then “
Set Countup = Countup + 1
End Calculations
Output Data
Write, “There were, “Countm, Salaries entered”
Write,” the mean salary is mean”
Write,” There are,” Countup, “employees who make more than the (average)”
Write, “There are,” Countdown, “employees who make less than the (average)”
End output data
__________________
__________________
