Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

~~~MUST BE IN PYTHON~~~ (Financial application: compute commissions) Write a fun

ID: 638154 • Letter: #

Question

~~~MUST BE IN PYTHON~~~

(Financial application: compute commissions) Write a function that computes
the commission, using the scheme in Exercise 5.39. The header of the function is:
def computeCommission(salesAmount):
Write a test program that displays the following table:
Sales Amount Commission
10000 900.0
15000 1500.0
...
95000 11100.0
100000 11700.0

OUTPUT:

6. (Financial application: compute commissions) Write a function that computes the commission, using the scheme in Exercise 5.39. The header of the function is: def computeCommission(salesAmount): Write a test program that displays the following table: Sales Amount 10000 900.0 1500.0 15000 95000 100000 11100.0 11700.

Explanation / Answer

def computeCommission(salesAmount):
   if (salesAmount >= 10000.0):
       return 5000.0*0.08 + (10000.0 - 5000.0)*0.10 + (salesAmount - 10000.0)*0.12;
   elif (salesAmount >= 5000.0):
       return 5000.0*0.08 + (salesAmount - 5000.0)*0.10;
   return salesAmount*0.08;
  
n = 10000;
print 'Sales Amount',' ','Commission'
while (n <= 100000):
   print str(n)+' '+str(computeCommission(n));
   n += 5000;