Author: Not specified Language: python
Description: Not specified Timestamp: 2018-04-03 08:14:03 +0000
View raw paste Reply
  1. class Account(object):
  2.     def __init__(self, holder, number,balance, credit_line = 1500):
  3.         self.Holder = holder
  4.         self.Number = number
  5.         self.Balance = balance
  6.         self.CreditLine = credit_line
  7.        
  8.     def deposit(self, amount):
  9.         self.Balance = amount
  10.    
  11.     def withdraw(self, amount):
  12.         if(self.Balance - amount < -self.CreditLine):
  13.             return False
  14.         else:
  15.             self.Balance -=amount
  16.             return True
  17.    
  18.     def balance(self):
  19.         return self.Balance
  20.    
  21.     def transfer(self, target, amount):
  22.         if(self.Balance-amount <-self.CreditLine):
  23.             return False
  24.         else:
  25.             self.Balance -= amount
  26.             target.Balance += amount
  27.             return True
View raw paste Reply