# 模拟咖啡机
from lists import menuCoffe
totalWater = 1500 #初始化咖啡机的水量
totalMilk = 1000 #初始化咖啡机的牛奶量
totalCoffe = 500 #初始化咖啡机的咖啡量
totalCoin = 0 #咖啡机已经收到的硬币
pswd = "123456" #管理员的密码,输入可加入配料
isOff = False #关机标记
while not isOff:
inputCoffe = input("你要哪种咖啡?\n(1)蒸馏咖啡\n(2)拿铁\n(3)卡布奇诺\n")
chosenCoffe = ""
paySum = 0 #初始化用户的支付总额
isPayFinish = False #支付完毕标记
while inputCoffe != "off" and inputCoffe != "check" and inputCoffe != pswd and inputCoffe != "1" and inputCoffe != "2" and inputCoffe != "3":
inputCoffe = input("你要哪种咖啡?\n(1)蒸馏咖啡\n(2)拿铁\n(3)卡布奇诺\n") #如果输入不合法,提示继续输入
match inputCoffe:
case "off": #输入off关机
print("关机")
isOff = True
case "check": #输入check显示当前配料的剩余量
print(f"剩余水量{totalWater}ml\n剩余牛奶{totalMilk}ml\n剩余咖啡{totalCoffe}g\n硬币总额{totalCoin}")
case _:
if inputCoffe == pswd: #输入密码,则可以加入配料
addWater = int(input("请输入加水量(ml)\n"))
totalWater += addWater