. Develop an algorithm pseudo-code or flowchart that will accept the names of each sales
staff members and their total sales for the month. The algorithm must calculate the
commission at 5 % of their total sales amount. It should display only the name, total
sales and commission of the staff member with the highest commission.
maxname=""
maxsales=0
maxcomm=0
name="x" ; stop reading on a blank line
while name ≠ "" {
read name,sales
comm = sales*0.05
if comm > maxcomm {
maxname=name
maxsales=sales
maxcom=comm
}
}
display maxname,maxsales,maxcomm
Sure! Here's an algorithm pseudo-code to solve this problem:
1. Initialize variables:
- highest_commission = 0
- highest_commission_name = ""
2. Accept the number of sales staff members (let's say it's n)
3. For each staff member from 1 to n, do the following:
- Accept the name of the staff member (let's say it's name)
- Accept the total sales amount for the month (let's say it's total_sales)
- Calculate the commission amount as 5% of total_sales (let's say it's commission)
- If commission is greater than highest_commission, then:
- Set highest_commission to commission
- Set highest_commission_name to name
4. Display the name, total sales, and commission of the staff member with the highest commission:
- Display highest_commission_name, highest_commission, and highest_commission * 0.05 (which is the 5% commission amount)
And that's it! This algorithm will find the staff member with the highest commission and display their details. You can implement this algorithm in your programming language of choice using the provided pseudo-code as a guide.