Ask questions and get helpful answers.

Input a list of employee names and salaries stored in parallel arrays. The sal-aries should be floating point numbers in increments of 100. For example, a salary of $ 36,000 should be input as 36.0 and a salary of $ 85,900 should be input as 85.9. Find the mean ( average) salary and display the names and salaries of employees who earn within a range of $ 5,000 from the mean. In other words, if the mean salary is $ 45,000, all employees who earn between $ 40,000 and $ 50,000 should be displayed.

  1. 👍
  2. 👎
  3. 👁
  4. ℹ️
  5. 🚩
1 answer
  1. Declare employeeNames[100] As String
    Declare employeeSalaries[100] as float
    Declare name as String
    Declare salary, totalSalary as float
    Declare averageSalary as float
    Declare count as integer
    Set count = 0;
    Set totalSalary =0
    Write “Enter employee name. (Enter * to quit.)”
    Input name
    While name != “*” and count < 100
    Set employeeNames [count] = name
    Write “Enter salary for “ + name + “.”
    Input salary
    Set employeeSalaries[count] = salary
    totalSalary = totalSalary + salary
    Set count = count + 1
    End While
    Set averageSalary = totalSalary / count
    Declare x as integer
    Declare rangeMin, rangeMax as float
    Set rangeMin = averageSalary - 5
    Set rangeMax = averageSalary + 5
    Write “The following employees have a salary within $5,000 of the mean salary of “ + averageSalary + “.”
    For (x = 0; x < count; x++)
    If (employeeSalaries[x] >= rangeMin or employeeSalaries[x] <= rangeMax )
    Write employeeNames[x] + “\t” + employeeSalaries[x]
    End if
    End for

    1. 👍
    2. 👎
    3. ℹ️
    4. 🚩

Answer this Question

Related Questions

Still need help?

You can ask a new question or browse existing questions.