plz answer this question as fast as possible
Answers
The following codes have been written using Python.
Code 1:
tc = float(input("Enter the total cost: "))
if tc <= 2500:
d = 0.05
ta = tc - (tc*d)
print(ta, "is the total amount to be paid.")
elif tc >= 2501 and tc <= 5000:
d = 0.10
ta = tc - (tc*d)
print(ta, "is the total amount to be paid.")
elif tc >= 5001 and tc <= 12000:
d = 0.15
ta = tc - (tc*d)
print(ta, "is the total amount to be paid.")
elif tc > 12000:
d = 0.20
ta = tc - (tc*d)
print(ta, "is the total amount to be paid.")
Code 2:
while True:
print("1. Espresso")
print("2. Macchiato")
print("3. Café Americano")
print("4. Café Mocha")
print()
c = int(input("Enter your choice: "))
if c == 1:
nc = int(input("Enter the number of cups you'd like: "))
p = 116*nc
print(p, "is your total amount to be paid.")
print()
print("Thank you! :)")
elif c == 2:
nc = int(input("Enter the number of cups you'd like: "))
p = 142*nc
print(p, "is your total amount to be paid.")
print()
print("Thank you! :)")
elif c == 3:
nc = int(input("Enter the number of cups you'd like: "))
p = 142*nc
print(p, "is your total amount to be paid.")
print()
print("Thank you! :)")
elif c == 4:
nc = int(input("Enter the number of cups you'd like: "))
p = 163*nc
print(p, "is your total amount to be paid.")
print()
print("Thank you! :)")
else:
print("Invalid choice")
print()
continue
print()
cn = input("Next customer? [Y/N]: ")
print()
if cn in "Nn":
break