Access over 20 million homework & study documents

search

IT210 - Week 5 CheckPoint-Simple Array Process - Week 5

Type

Homework

Rating

Showing Page:
1/2
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.
Main Module
Declare Salaries[100] as integers
Declare minSal as integer
Declare maxSal as integer
Declare SalCount as integer
Declare Amount as integer
Call Input Module
Call Sort Module
Call Minimum Module
Call Maximum Module
Call Output Module
End Main Module
Input Module
Declare SalCount as integer
Declare Amount as integer
Display "Please enter the salaries"
Display "Enter 0 to end the program"
Set SalCount = 0
Set Amount = 1
While SalCount <= 100 and Amount <> 0
Display "Enter the salary amount: "
Amount
if Amount <> 0
Set SalCount = SalCount + 1
Set Salaries[SalCount] = Amount
end if
end while
End Input Module
Sort Module
Declare flag as integer
Declare k as integer
Declare temp as integer
Set flag = 0
Set count = 0
While flag = 0
set flag = 1

Sign up to view the full document!

lock_open Sign Up
for k = 1 step 1 to SalCount
if Numbers[k] > Salaries[k + 1] then
Set temp = Salaries[k]
Set Salaries[k] = Salaries[k + 1]
Set Salaries[k + 1] = temp
Set Flag = 0
end if
end for
End While
End Sort Module
Minimum Module
if SalCount >= 1 then
minSalaries = Salaries[1]
else
minSal = 0
end if
End Minimum Module
Maximum Module
if SalCount > =1 and SalCount <= 100 then
maxNum = Salaries[SalCount]
else
maxSal = 0
end if
End Maximum Module
Output Module
if SalCount >= 1 then
Display "The salaries below the average are: "
Write minSal
Display "The above the average are: "
Write maxSal
end if
End Output Module

Sign up to view the full document!

lock_open Sign Up
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Awesome! Perfect study aid.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4