I created this program in Python.
SMuffin = 10
SCake = 1
NewTrans = 'y' #New transaction added for multiple inputs
while NewTrans == 'y': #While is used for multiple transactions until the user inputs "0".
Scheck = str(input("Enter cupcake or muffin: "))
if Scheck == 'cupcake':
if SCake == 0:
print("Out of stock")
else:
print("Cupcake Sold")
SCake -= 1
elif Scheck == 'muffin':
if SMuffin == 0:
print("Out of stock")
else:
print("Muffin Sold")
SMuffin -= 1
elif Scheck == '0':
print("Muffins:",SMuffin,"Cupcakes:",SCake)
else:
print("Invalid input!")
NewTrans = str(input("New Transaction?: (y/n)"))
if NewTrans == 'n':
print("Muffins:",SMuffin,"Cupcakes:",SCake)