June is Combung
ATM[3단계] 본문
# ATM[3단계]
# 1. 로그인
# . 로그인 후 재 로그인 불가
# . 로그아웃 상태에서만 이용 가능
# 2. 로그아웃
# . 로그인 후 이용가능
# 3. 입금
# . 로그인 후 이용가능
# 4. 출금
# . 로그인 후 이용가능
# 5. 이체
# . 로그인 후 이용가능
# 6. 조회
# . 로그인 후 이용가능
# 7. 종료
db_acc1 = 1111
db_pw1 = 1234
db_money1 = 50000
db_acc2 = 2222
db_pw2 = 2345
db_money2 = 70000
log = -1
run = True
while run:
print("1.로그인")
print("2.로그아웃")
print("3.입금")
print("4.출금")
print("5.이체")
print("6.조회")
print("0.종료")
choice = int(input("메뉴 선택 : "))
if choice == 1:
if log == -1:
ID = int(input("id를 입력하세요: "))
PW = int(input("pw를 입력하세요: "))
if ID==db_acc1 and PW==db_pw1:
log=1
print("db_acc1님, 환영합니다.")
elif ID==db_acc2 and PW==db_pw2:
log=2
print("db_acc2님, 환영합니다.")
else:
print("id 혹은 pw 오류입니다.")
else:
print("이미 로그인 되어있습니다.")
elif choice == 2:
if log == -1:
print("이미 로그아웃 되어있습니다.")
else:
print("로그아웃 되었습니다.")
log = -1
elif choice == 3:
if log == -1:
print("로그인 후 이용해주세요.")
elif log == 1:
money = int(input("입금할 금액을 입력하세요: "))
db_money1 += money
print("입금완료")
else:
money = int(input("입금할 금액을 입력하세요: "))
db_money2 += money
print("입금완료")
elif choice == 4:
if log == -1:
print("로그인 후 이용해주세요.")
elif log == 1:
money = int(input("출금할 금액을 입력하세요: "))
if money<=db_money1:
db_money1 -= money
print("출금완료")
else:
print("잔액부족")
else:
money = int(input("출금할 금액을 입력하세요: "))
if money<=db_money2:
db_money2 -= money
print("출금완료")
else:
print("잔액부족")
elif choice == 5:
if log == -1:
print("로그인 후 이용해주세요.")
elif log == 1:
acc = int(input("이체할 계좌번호 입력: "))
if acc == db_acc2:
money = int(input("이체할 금액을 입력하세요: "))
if money<=db_money1:
db_money1 -= money
db_money2 += money
print("이체완료")
else:
print("잔액부족")
else:
print("잘못된 계좌번호입니다.")
else:
acc = int(input("이체할 계좌번호 입력: "))
if acc == db_acc1:
money = int(input("이체할 금액을 입력하세요: "))
if money<=db_money2:
db_money2 -= money
db_money1 += money
print("이체완료")
else:
print("잔액부족")
else:
print("잘못된 계좌번호입니다.")
elif choice == 6:
if log == -1:
print("로그인 후 이용해주세요.")
else:
print("db_acc1 잔액 >> ",db_money1)
print("db_acc2 잔액 >> ",db_money2)
elif choice == 0:
run = False
print("프로그램 종료")
Comments