Python Programming ( Financial application: compute commissions ) Write a functi
ID: 3595882 • Letter: P
Question
Python Programming
(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):
6.1 (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 Commission 900.0 1500.0 15000 11100.0 11700.0 95000 100000Explanation / Answer
def computeCommission( salesAmount ):
commission = 0 #initialising commision to 0
# assigning commission based on sales
# as per the scheme 5.39
if( salesAmount >= 0.01 and salesAmount <= 5000 ):
commission = 8
elif( salesAmount >= 5000.01 and salesAmount <= 10000 ):
commission = 10
elif( salesAmount >= 10000.01 ):
commission = 12
# returning the commission amount
return ( (salesAmount * commission ) / 100 )
# test program
amount = 10000
print "Sales Amount ",
print "Commission "
while ( amount <= 100000 ):
print amount ,
print " " ,
print computeCommission(amount)
amount = amount + 5000
# hope this helps
# if any doubts please comment
# thank you
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.