June is Combung
영화관 좌석예매 본문
# 영화관 좌석예매
# 1. 사용자로부터 좌석번호(index)를 입력받아 예매하는 시스템이다.
# 2. 예매가 완료되면 해당 좌석 값을 1로 변경한다.
# 3. 이미 예매가 완료된 좌석은 재구매할 수 없다.
# 4. 한 좌석당 예매 가격은 12000원이다.
class MegaBox:
seat = [0 for i in range(7)]
money = 0
mega = MegaBox()
size = len(mega.seat)
while True:
print("[1]좌석예매")
print("[2]종료하기")
sel = int(input("메뉴 선택 : "))
if sel == 1:
print(mega.seat)
idx = int(input("예매할 좌석 인덱스: "))
cnt = 0
if mega.seat[idx] == 0:
mega.seat[idx] = 1
print("예매 완료")
mega.money += 12000
else:
print("이미 예매된 좌석입니다.")
elif sel == 2:
print("금액은 %d원 입니다."%mega.money)
break
Comments