write a program to enter item no., quantity purchased and rate. calculate the total purchase price and print it with the gifts. the gifts to the customers are given in the following manner:
100 and above but less than 500
gift: a key ring
500 and above but less than 100
gift: a leather purse
1000 and above
gift: a pocket calculator
Answers
Answered by
4
The following codes have been written using Python.
#obtaining the item number
itmno = int(input("Enter the item number: "))
#obtaining the quantity purchased
qty = int(input("Enter the quantity purchased: "))
#obtaining the rate
rate = float(input("Enter the rate: "))
#calculating the total price and displaying it
tp = qty*rate
print()
print("Item number: ", itmno)
print("Total cost: ", tp)
#using conditional statements to print the required gift
if tp >= 100 and tp < 500:
print("Congratulations! You get a free Key Ring!")
elif tp >= 500 and tp < 1000:
print("Congratulations! You get a free Leather Purse!")
elif tp >= 1000:
print("Congratulations! You get a free Pocket Calculator!")
Similar questions
Math,
1 month ago
Computer Science,
1 month ago
Math,
2 months ago
Math,
2 months ago
Computer Science,
9 months ago
Computer Science,
9 months ago
English,
9 months ago