# Tiered sales commission example
# Test code
sum = 0.0
egg = 5000 * 0.05 # $5 x 5 cents = 25 cents
print(egg)
sum += egg
egg = 5000 * 0.08 # $5 x 8 cents = 40 cents
print(egg)
sum += egg
egg = 9000 * 0.12 # $5 x 12 cents = 108 cents or $1.08
print(egg)
sum += egg
print(); print()
total_commission_earned = 0.0
total_revenue = 19000
if total_revenue <= 5000:
total_commission_earned = total_revenue * 0.05
elif total_revenue > 5000 and total_revenue <= 10000:
total_commission_earned = (5000 * 0.05) + ((total_revenue - 5000) * 0.08)
elif total_revenue > 10000 and total_revenue <= 25000:
total_commission_earned = (5000 * 0.05) + (5000 * 0.08) + ((total_revenue - 10000) * 0.12)
print("Total Revenue: " + str(total_revenue))
print("Total Commission Earned: " + str(total_commission_earned))
print(); print()
# A nested if version of the code above.
# total_commission_earned = 0.0
# total_revenue = 10000
if total_revenue <= 5000:
total_commission_earned = total_revenue * 0.05
else:
if total_revenue > 5000 and total_revenue <= 10000:
total_commission_earned = (5000 * 0.05) + ((total_revenue - 5000) * 0.08)
else:
total_commission_earned = (5000 * 0.05) + (5000 * 0.08) + ((total_revenue - 10000) * 0.12)
print("Total Revenue: " + str(total_revenue))
print("Total Commission Earned: " + str(total_commission_earned))