A showroom gives discount according to the following slab rates on the purchase amount: Amount Discount Less than or equal to 5,000 nil More than 5,000 and less than or equal to 10,000 10% of amount exceeding 5,000 More than 10,000 and less than or equal to 20,000 20% of amount exceeding 10,000 More than 20,000 and less than or equal to 30,000 30% of amount exceeding 20,000 More than 30,000 50% of amount exceeding 30,000 If discount is greater than 5,000 a special discount of 2.5% is also given on the purchase amount. Write a program to input name of the customer and purchase amount. Compute total payment amount and display all the details in the given format. Name of the customer Purchase Amount Discount Amount to be paid XXX XXX XXX XXX
Answers
Answered by
6
The following cσdes have been written using Python.
n = input("Enter the name of the customer: ")
pa = float(input("Enter the purchase amount: "))
print()
if pa <= 5000:
d = 0
ta = pa - (pa*d)
elif pa > 5000 and pa <= 10000:
d = 0.10
ta = pa - (pa*d)
elif pa > 10000 and pa <= 20000:
d = 0.20
ta = pa - (pa*d)
elif pa > 20000 and pa <= 30000:
d = 0.30
ta = pa - (pa*d)
elif pa > 30000:
d = 0.50
ta = pa - (pa*d)
print("Customer name: ", n)
print("Purchase amount: ", pa)
print("Discount received: ", d)
if ta > 5000:
sd = 0.025
nta = ta - (ta*d)
print("Special discount received: ", sd)
print("Amount to be paid: ", nta)
else:
print("Amount to be paid: ", ta)
Similar questions