https://revel-ise.pearson.com/courses/6123e8c3e405345b4db8cc88/pages/a01d5f11c73c1edccab32f3f774833239daa8769e Page 11 of 15
Programming Exercises from the Book: Chapter 5 8/23/21, 3:12 PM
Note that this is a graduated rate. The rate for the first $5,000 is at 8%, the next $5,000 is at 10%, and the rest is at 12%. If the sales amount is 25,000, the commission is 5,000 * 8% + 5,000 * 10% + 15,000 * 12% = 2,700. Your goal is to earn $30,000 a year. Write a program that finds the minimum sales you have to generate in order to make $30,000.
def getSales(money):
if (money <= 5000):
return money * 0.08
elif (money <= 10000):
return 5000 * 0.08 + (money-5000) * 0.1
elif (money > 10000):
return 5000 * 0.08 + 5000 * 0.1 + (money - 10000) * 0.12
else:
return 'Number must be positive'
print('required minimum sales: ', getSales(30000))
Comments
Leave a comment