Esempio n. 1
0
bank = Bank()

client1 = Client("Misa", 25)
client2 = Client("Lucy", 20)
client3 = Client("Asuna", 18)

account1 = AccountPP(agency=1111, account_number=254136, balance=0)
account2 = AccountCC(agency=2222, account_number=321453, balance=0, limit=500)
account3 = AccountPP(agency=1422, account_number=221355, balance=0)

client1.insert_account(account1)
client2.insert_account(account2)
client3.insert_account(account3)

bank.insert_client(client1)
bank.insert_account(account1)

if bank.authenticate(client1):
    client1.account.deposit(100)
    client1.account.draw(30)
else:
    print("Unkown client")

print("####################")

if bank.authenticate(client2):
    client2.account.deposit(100)
    client2.account.draw(30)
else:
    print("Unkown client")
Esempio n. 2
0
from random import randint
from bank import Bank
from checking_account import CheckingAccount
from savings_account import SavingsAccount
from customer import Customer

bank = Bank()

luiz = Customer('Luiz', 25)
maria = Customer('Maria', 52)

savings_account = SavingsAccount(1111, 32460, 0)
checking_account = CheckingAccount(2222, 32461, 0)

luiz.insert_account_number(savings_account)
maria.insert_account_number(checking_account)

bank.insert_account(savings_account)
bank.insert_customer(luiz)

bank.insert_account(checking_account)
bank.insert_customer(maria)

for customer in [luiz, maria]:
  if bank.authenticate(customer):
    customer.account.deposit(randint(500, 1000))
    customer.account.withdraw(randint(50, 100))
  else:
    print('Unauthenticated customer')