Final answer:
The Python program sorts employee salaries in ascending and descending order, applies a 5% raise, and calculates the average weekly salary. The pseudocode and algorithm provided demonstrate these processes in a simplified manner.
Step-by-step explanation:
To sort the employees' salaries and apply a salary increase, you can use the following Python program:
# The original weekly salaries
salaries = [500, 300, 700, 400, 600, 550]
# Sort salaries in ascending order
ascending_salaries = sorted(salaries)
print('Ascending order:', ascending_salaries)
# Sort salaries in descending order
descending_salaries = sorted(salaries, reverse=True)
print('Descending order:', descending_salaries)
# Apply a 5% raise to each salary
increased_salaries = [s * 1.05 for s in salaries]
print('Salaries with a 5% raise:', increased_salaries)
# Calculate the average weekly salary
average_salary = sum(increased_salaries) / len(increased_salaries)
print('Average weekly salary:', average_salary)
When you run this program, you'll get the salaries sorted in both orders, the new salaries after a 5% raise, and the average weekly salary. For pseudocode for the 5% raise:
FOR each salary IN salaries
salary = salary * 1.05
OUTPUT salary
ENDFOR
The algorithm to compute the average weekly salary is:
SET total to 0
FOR each salary IN increased_salaries
total = total + salary
ENDFOR
SET average_salary to total / number of salaries
OUTPUT average_salary
And for calculating the average, you take the sum of the increased salaries and divide it by the number of employees.