Ejemplo n.º 1
0
class User:  # here's what we have so far
    def __init__(self, name, email):
        self.name = name
        self.email = email
        self.account = BankAccount(4.0)

    # adding the deposit method
    def make_deposit(
            self,
            amount):  # takes an argument that is the amount of the deposit
        self.account.deposit(amount)
        return self

    def make_withdrawl(self, amount):
        self.account.withdraw(amount)
        return self

    def display_user_balance(self):
        self.account.display_account_info()
        return self

    def transfer_money(self, other_user, amount):
        other_user.account.deposit(amount)
        self.account.withdraw(amount)
        return self
class User:
    def __init__(self, name, email):
        self.name = name
        self.email = email
        self.account = BankAccount()

    def deposit(self, amount):
    	self.account.deposit(amount)
    def make_withdrawal(self, amount):
    	return self.account.withdraw(amount)
    def display_user_balance(self):
        self.account.display_account_info()
        print(f"{self.name} balance is:{self.balance}")
    def transfer_money(self,other_user,amount):
        if self.withdrawal(amount):
            other_user.deposit(amount)
            return True
        return False     
Ejemplo n.º 3
0
class user:
    def __init__(self, name, email):
        self.name = name
        self.email = email
        self.account = BankAccount()

    def make_deposite(self, amount):
        self.account.deposit(amount)

    def make_withdrawal(self, amount=0):
        self.account.withdraw(amount)

    def display_user_balance(self):
        print("User Name: " + self.name + ", User Balance: ", end=" ")
        self.account.display_account_info()

    def transfer_money(self, other_user, amount):
        if self.make_withdrawal(amount):
            other_user.make_deposite(amount)
            return True
        return False