Question: Please, I need some help writing the Algorithm and document every statement in this program. The program is already done, you can find it at
Please, I need some help writing the Algorithm and document every statement in this program. The program is already done, you can find it at the bottom of this problem. The codes are at the end of the problem.
Problem:
Hal owns a business named Make Your Own Music, which sells guitars, drums, banjos, synthesizers, and many other musical instruments. Hals sales staff works strictly on commission. At the end of the month, each salespersons commission is calculated according to table below:
Sales This Month Commission Rate
Less than $10,000 10%
$10,000 - 14,999 12%
$15,000 - 17,999 14%
$18,000 - 21,999 16%
$22,000 or more 18%
For example, a salesperson with $16,000 in monthly sales will earn a 14 percent commission ($2,240). Another salesperson with $18,000 in monthly sales will earn a 16 percent commission ($2,880). A person with $30,000 in sales will earn an 18 percent commission.
Because the staff gets paid once per month, Hal allows each employee to take up to $2,000 per month in advance. When sales commissions are calculated, the amount of each employees advanced pay is subtracted from the commission. If any salespersons commissions are less than the amount of their advance, they must reimburse Hal for the difference. To calculate a salespersons monthly pay, Hal uses the following formula:
Pay = sales X commission rate advanced pay
Hall has asked you to write a program in python programing language that makes this calculation for him. The following general algorithm outlines the steps the program must take.
Get the salespersons monthly sales.
Get the amount of advanced pay.
Use the amount of monthly sales to determine the commission rate.
Calculate the salespersons pay using the formula previously shown. If the amount is negative, indicate that the salesperson must reimburse the company.
Program:
sales = float(input("Enter monthly sales of sales person: "));
advance = float(input("Enter the advance amount taken by sales person: "));
if(sales < 10000):
rate = 0.10
elif (sales < 15000):
rate = 0.12
elif (sales < 18000):
rate = 0.14
elif (sales < 22000):
rate = 0.16
else:
rate = 0.18
pay = sales * rate - advance
if (pay < 0):
print("The salesperson should reimburse back to company ${:.2f}" .format(abs(pay)))
else:
print("The salesperson will be receive ${:.2f} from company" .format(pay))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
