'''
Online Python Compiler.
Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.
'''
#https://www.omnicalculator.com/finance/discount#discount-formula
#three inputs asking for the membershipfee, groups and years
while True:
m = int(input("Enter the base membership fee, or zero to quit: "))
if m == 0:
break
g = int(input("Enter the group count: "))
years = int(input("Enter the number of membership years: "))
#calculation to work out the fee
fee = m * g
discount = 0
#checks to see if the number of group is more than 5 so that the additional % fee can be added
if g==1:
#calculates the extra cost if the condition is true
if years == 0:
discount = fee * 0/100
elif years >= 1 and years <= 3:
discount = fee * 10/100
elif years >= 4:
discount = fee * 20/100
else :
print("Have a Nice day!")
elif g>=2 and g<=4:
#calculates the extra cost if the condition is true
if years == 0:
discount = fee * 10/100
elif years >= 1 and years <= 3:
discount = fee * 20/100
elif years >= 4:
discount = fee * 30/100
else :
print("Have a Nice day!")
elif g>=5:
#calculates the extra cost if the condition is true
if years == 0:
discount = fee * 20/100
elif years >= 1 and years <= 3:
discount = (fee * 30/100)
elif years >= 4:
discount = fee * 40/100
else :
print("Have a Nice day!")
else :
print("Have a Nice day!")
#discounted_price = original_price - (original_price * discount / 100)
total = fee - discount
#displays the total fee after discount
print("Total fee before discount is ${:.2f}".format(fee))
#displays the Discount
print("Discount is ${:.2f}".format(discount))
#displays the total fee after discount
print("Total fee after Discount is ${:.2f}".format(total))
print("Have a Nice day!")