Phyton 3 Required: Write the Algorithm and the program Software Sales Programmin
ID: 3593675 • Letter: P
Question
Phyton 3
Required:
Write the Algorithm and the program
Software Sales Programming Problem:
A Software Company in New Jersey sells a package that retails for $99. Quantity discounts are given according to the following table:
Quantity Discount
10-19 10%
20-49 20%
50-99 30%
100 or more 40%
Write a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.
Please post the Algorithm and the program
Explanation / Answer
algorithm
input(package_sold)
if(package_sold >= 100)
discount = 40 % of (package_sold * cost of one package)
else if (package_sold > = 50 and package_sold <=99)
discount = 30 % of (package_sold * cost of one package)
else if (package_sold > = 20 and package_sold <=49)
discount = 20 % of (package_sold * cost of one package)
else if (package_sold > = 10 and package_sold <=19)
discount = 10 % of (package_sold * cost of one package)
else
discount = 0
output (discount)
python code
package_sold = int (input("enter no of packages sold"))
if(package_sold >=100):
discount = 0.4*99*package_sold
elif (package_sold >= 50 and package_sold <= 99):
discount = 0.3*99*package_sold
elif(package_sold >= 20 and package_sold <= 49):
discount = 0.2*99*package_sold
elif(package_sold >= 10 and package_sold <= 19):
discount = 0.1*99*package_sold
else:
discount = 0
print("discount is ",discount)