A software company sells a package that retails for $99. Quantity discounts are
ID: 3796169 • Letter: A
Question
A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Quantity Discount 10 – 19 20% 20 – 49 30% 50 – 99 40% 100 or more 50% Write a program using python that asks the user to enter the number of packages purchased. The program should then display the amount of discount, the subtotal after the discount, the tax (0.11), and the total. Be sure to use input, format, and the if elif and else statements correctly.
Here is a sample of how the output should look like.
Enter the number of packages: 999
Discount. 50%
Subtotal. $49,450.00
Tax. $ 5,436.56
Total $54,890.06
Explanation / Answer
price = 99
discount = 0
# read the number of packages
packages = int(input("Enter the number of Packages: "))
# find discount on the bases of number of packages
if packages >= 10 and packages < 20:
discount = 0.20
elif packages >= 20 and packages < 50:
discount = 0.30
elif packages >= 50 and packages < 100:
discount = 0.40
elif packages >= 100:
discount = 0.50
# calculate amount of purchase
amountOfPurchase = packages * price
# discount value if any
discount = amountOfPurchase * discount
# display the discount amount, if any
if discount > 0:
print ("Discount Amount: " + str(discount))
# decut discount from total purchase
amountOfPurchase = amountOfPurchase - discount
# display the total amount of purchase
print ("Total amount of purchase: " + str(amountOfPurchase))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.