1. 程式人生 > >面向物件與銀行管理系統 ATM剩餘功能

面向物件與銀行管理系統 ATM剩餘功能

.
.
.
def save_menoy(self): #存錢4
    card_num = int(input('請輸入卡號:'))
    user = self.user_dict.get(card_num)
    if user == None:
        print('卡號不存在!')
        return
    if user.card.is_lock == True:
        print('此卡已被鎖定,請重新解鎖!')
        return
    for i in range(3):
        passwd = int(input('請輸入密碼:'))
        if passwd != user.card.passwd:
            print('密碼錯誤')
        else:
            money = int(input('請輸入存款金額:'))
            user.card.money+=money
            print('存款成功,當前餘額:',user.card.money)
            return
    else:
        print('機會以用完!此卡被鎖定')
        user.card.is_lock = True
        return
def pass_menoy(self): #轉賬5
    card_num = int(input('請輸入卡號:'))
    user = self.user_dict.get(card_num)
    if user == None:
        print('卡號不存在!')
        return
    if user.card.is_lock == True:
        print('此卡已被鎖定,請重新解鎖!')
        return
    for i in range(3):
        passwd = int(input('請輸入密碼:'))
        if passwd != user.card.passwd:
            print('密碼錯誤')
        else:
            card_num1 = int(input('請輸入轉賬卡號:'))
            user1 = self.user_dict.get(card_num1)
            if user1 == None:
                print('卡號不存在!')
                return
            if user1.card.is_lock == True:
                print('此卡已被鎖定,請重新解鎖進行轉賬!')
                return
            else:
                money = int(input('請輸入轉賬金額:'))
                if money>user.card.money:
                    print('錢不夠怎麼轉?傻逼!')
                user.card.money -= money
                user1.card.money+=money
                print('轉賬成功,當前餘額:', user.card.money)
                return
    else:
        print('機會以用完!此卡被鎖定')
        user.card.is_lock = True
        return
def change_pad(self): #改密6
    print('改密')
def lock_user(self): #鎖卡7
    print('鎖卡')
def unlock_user(self): #解鎖8
    card_num=int(input('請輸入卡號:'))
    user=self.user_dict.get(card_num)
    if user==None:
        print('卡號不存在!')
        return
    if user.card.is_lock==True:
        print('此卡已被鎖定,是否解鎖?輸入y解鎖 n取消解鎖')
        num=input('')
        if num=='y':
            print('解鎖成功!')
            user.card.is_lock = False
            return
        elif num=='n':
            print('取消成功!')
            user.card.is_lock = True
            return
def del_user(self): #登出9
    print('登出')
def launch(self): #退出0
    print('退出成功,歡迎下次光臨')
    quit()

部分功能程式碼不再寫   功能邏輯都一樣  溜了溜了.....