class Account:
def __init__(self, name, balance, limit):
self.name = name
self.balance = balance
self.limit = limit
def withdraw(self, amount):
if amount > self.limit:
exceed = amount - self.limit
print(f"출금 실패. 1일 한도를 {exceed}원 초과했습니다.")
return
if amount > self.balance:
shortage = amount - self.balance
print(f"출금 실패. 잔액이 {shortage}원 부족합니다.")
return
self.balance -= amount
print(f"{amount}원 출금 완료. 잔액: {self.balance}원")
def transfer(self, target_account, amount):
if amount > self.limit:
exceed = amount - self.limit
print(f"이체 실패. 1일 한도를 {exceed}원 초과했습니다.")
return
if amount > self.balance:
shortage = amount - self.balance
print(f"이체 실패. 잔액이 {shortage}원 부족합니다.")
return
self.balance -= amount
target_account.balance += amount
print(f"{amount}원 이체 완료")
account1 = Account("홍길동", 500000, 1000000)
account2 = Account("김철수", 500000, 1000000)
account1.transfer(account2, 600000)
print("홍길동 잔액:", account1.balance)
print("김철수 잔액:", account2.balance)
To embed this project on your website, copy the following code and paste it into your website's HTML: