Asked by Jen
                I was wondering if someone could review my pseudocode to see if I got this right.
Here is the question: Input a list of employee names and salaries, and dtermine the mean (average) salary as well as the number of salaries above and below the mean.
Here is my pseudocode:
Declare Names[20] Of Strings
Declare Salary[20, 2] Of Integers
Declare Count, Salary, K, J As Integer
Declare EmployeeName As String
Declare Sum, Average As Real
Set Count = 0
Write “Enter an employee’s name; enter * when done.”
Input EmployeeName
While EmployeeName <> “*”
Set Count = Count + 1
Set Name[Count] = EmployeeName
Write “Enter salary for ” , Names[Count]
For Test = 1 Step 1 To 2
Input Salary[Count, Test]
End For
Write “Enter an employee’s name; enter * when done.”
Input EmployeeName
End While
While the array A is not sorted
For K = 1 Step 1 To N – 1
If A[K] > A[K + 1]
Interchange A[K] and A[K + 1]
End If
End For
End While
For K = 1 Step 1 To Count
Set Sum = 0
For J = 1 Step 1 To 2
Set Sum = Sum + Salary[K,J]
End For J
Set Average = Sum / 2
Write Names[K], Average
End For (K)
            
            
        Here is the question: Input a list of employee names and salaries, and dtermine the mean (average) salary as well as the number of salaries above and below the mean.
Here is my pseudocode:
Declare Names[20] Of Strings
Declare Salary[20, 2] Of Integers
Declare Count, Salary, K, J As Integer
Declare EmployeeName As String
Declare Sum, Average As Real
Set Count = 0
Write “Enter an employee’s name; enter * when done.”
Input EmployeeName
While EmployeeName <> “*”
Set Count = Count + 1
Set Name[Count] = EmployeeName
Write “Enter salary for ” , Names[Count]
For Test = 1 Step 1 To 2
Input Salary[Count, Test]
End For
Write “Enter an employee’s name; enter * when done.”
Input EmployeeName
End While
While the array A is not sorted
For K = 1 Step 1 To N – 1
If A[K] > A[K + 1]
Interchange A[K] and A[K + 1]
End If
End For
End While
For K = 1 Step 1 To Count
Set Sum = 0
For J = 1 Step 1 To 2
Set Sum = Sum + Salary[K,J]
End For J
Set Average = Sum / 2
Write Names[K], Average
End For (K)
Answers
                    Answered by
            Jen
            
    here is the rest of the psuedocode:
Set Count = Count + 1
Set Name[Count] = EmployeeName
Write “Enter salary for ” , Names[Count]
For Test = 1 Step 1 To 2
Input Salary[Count, Test]
End For
Write “Enter an employee’s name; enter * when done.”
Input EmployeeName
End While
While the array A is not sorted
For K = 1 Step 1 To N – 1
If A[K] > A[K + 1]
Interchange A[K] and A[K + 1]
End If
End For
End While
For K = 1 Step 1 To Count
Set Sum = 0
For J = 1 Step 1 To 2
Set Sum = Sum + Salary[K,J]
End For J
Set Average = Sum / 2
Write Names[K], Average
End For (K)
    
Set Count = Count + 1
Set Name[Count] = EmployeeName
Write “Enter salary for ” , Names[Count]
For Test = 1 Step 1 To 2
Input Salary[Count, Test]
End For
Write “Enter an employee’s name; enter * when done.”
Input EmployeeName
End While
While the array A is not sorted
For K = 1 Step 1 To N – 1
If A[K] > A[K + 1]
Interchange A[K] and A[K + 1]
End If
End For
End While
For K = 1 Step 1 To Count
Set Sum = 0
For J = 1 Step 1 To 2
Set Sum = Sum + Salary[K,J]
End For J
Set Average = Sum / 2
Write Names[K], Average
End For (K)
                    Answered by
            Jen
            
    ah forget it, if I can't copy and paste its not worth it.
    
                                                    There are no AI answers yet. The ability to request AI answers is coming soon!
                                            
                Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.