1
+ """
2
+ 12. Software Sales
3
+ A software company sells a package that retails for $99.
4
+ Quantity discounts are given according to the following table:
5
+ Quantity Discount
6
+ 10_19 10%
7
+ 20_49 20%
8
+ 50_99 30%
9
+ 100 or more 40%
10
+ Write a program that asks the user to enter the number of packages purchased.
11
+ The program should then display the amount of the discount (if any) and the
12
+ total amount of the purchase after the discount.
13
+ Reference:
14
+ (1) Starting out with Python, Third Edition, Tony Gaddis Chapter 3
15
+ (2) https://youtu.be/0qHWyPWhZO4
16
+ """
17
+ # give value
18
+ package_price = 99
19
+ # Get the User Input(the number of packages purchased) and Convert to int
20
+ number_of_packages = int (input ("Please Enter the number of packages" + \
21
+ "purchased : " ))
22
+
23
+ # check All the conditions
24
+ if number_of_packages < 10 :
25
+ discount = 0
26
+ elif number_of_packages < 20 :
27
+ discount = 0.1 # 0.1 is 10%
28
+ elif number_of_packages < 50 :
29
+ discount = 0.2 # 0.2 is 20%
30
+ elif number_of_packages < 100 :
31
+ discount = 0.3 # 0.3 is 30%
32
+ else :
33
+ discount = 0.4 # 0.4 is 20%
34
+ # Calculate the discount amount and total amount
35
+ total_amount = number_of_packages * package_price
36
+ discount_amount = number_of_packages * discount
37
+ # Display the Result
38
+ print ("the amount of the discount is : $" + format (discount , ",.2f" ))
39
+ print ("total amount of the purchase after the discount is : $" + \
40
+ format (total_amount , ",.2f" ))
0 commit comments