コード例 #1
0
 def __init__(self, name, email):
     self.name = name
     self.email = email
     self.accounts = {
         "checking": BankAccount(0.01, 0),
         "saving": BankAccount(0.01, 0)
     }
コード例 #2
0
ファイル: user.py プロジェクト: egrilli/python-oop
 def __init__(self, name, email):
     self.name = name
     self.email = email
     self.account = {
         'Santander': BankAccount(0.4, 300),
         'Itau': BankAccount(0.2, 10000)
     }
コード例 #3
0
class testBankAccount(unittest.TestCase):
    def setUp(self):
        self.bankacc = BankAccount("Ivan", 30, '$')

    def test_get_balance(self):
        self.assertEqual(self.bankacc.get_balance(), 30)

    def test___str__(self):
        self.assertEqual(self.bankacc.__str__(),
                         "BankAccount for Ivan with balance of 30$")
コード例 #4
0
ファイル: user2.py プロジェクト: kozort/Python_Stack
class User:
	def __init__(self, name, email):
		self.name = name
		self.email = email
		self.account = BankAccount(int_rate=0.02, balance=0)

	def make_deposit(self, amount):
		self.account.deposit(amount)
		return self

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

	def display_user_balance(self):
		self.account.display_account_info()
		return self
    
	def transfer_money(self, otherUser, amount):
		self.account.withdraw(amount)
		otherUser.account.deposit(amount)
		return self
コード例 #5
0
ファイル: user_account.py プロジェクト: andrewjknell/Python
class User:
    def __init__(self,name,email):
        self.name = name
        self.email = email
        self.account = BankAccount( int = 5, balance = 0)
    def make_deposit(self, amount):
        self.account.deposit(amount)
        return self
    def make_withdrawl(self, amount):
        self.account.withdrawl(amount)
        return self
    def display_user_balance(self):
        print('User: '******'\nBalance: ' + str(self.account.balance))
        return self
    def transfer_money(self, to, amount):
        self.account.withdrawl(amount)
        to.account.deposit
        return self
コード例 #6
0
 def setUp(self):
     self.bankacc = BankAccount("Ivan", 30, '$')
コード例 #7
0
ファイル: user_account.py プロジェクト: andrewjknell/Python
 def __init__(self,name,email):
     self.name = name
     self.email = email
     self.account = BankAccount( int = 5, balance = 0)
コード例 #8
0
def bankAccount():
    return BankAccount(100)
コード例 #9
0
def empty_bankAccount():
    return BankAccount()
コード例 #10
0
ファイル: user.py プロジェクト: radek1982/CDPython
 def __init__(self, name):
     self.accounts = [BankAccount(int_rate=0.02)]
     self.name = name
コード例 #11
0
        account.withdraw(amount)

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

    def display_user_balance(self):
        print(f"User: {self.name}: ")
        for x in range(len(self.account)):
            print(f"Balance of account{x+1}: {self.account[x].balance}")

    def transfer_money(self, other_user, amount):
        self.make_withdrawal(amount)
        other_user.make_deposit(amount)
        print(f"{self.name} trnsfer to {other_user.name} by {amount}")

person1=User(name="Sam",)
acount1 = BankAccount(int_rate=0.02, balance=1000)
acount2 = BankAccount(balance=2000)
person1.addAccount(acount1)
person1.addAccount(acount2)

person1.make_deposit(10000,acount1)
person1.display_user_balance()
person1.make_withdrawal(500,acount1)
person1.display_user_balance()
# person2=User(name="Nora")
# person2.make_deposit(1000,acount1)
# person2.display_user_balance()
# person1.transfer_money(other_user=person2,amount=100)
# person1.display_user_balance()
# person2.display_user_balance()
コード例 #12
0
    def getTotalAccount(self):
        print(f'Tiene {len(self.accounts)} cuenta(s)')

    def make_deposit(self, id_account, amount):
        for account in self.accounts:
            if account.getId() == id_account:
                account.deposit(amount)

    def make_withdrawal(self, id_account, amount):
        for account in self.accounts:
            if account.getId() == id_account:
                account.withdraw(amount)

    def display_user_balance(self):
        for account in self.accounts:
            print('idAccount: {} {}'.format(account.getId(),
                                            account.display_account_info()))


if __name__ == '__main__':
    user = User('Juan', '*****@*****.**')
    cuenta1 = BankAccount(1, 0.02, 0)
    cuenta2 = BankAccount(2, 0.04, 100)
    user.add_account(cuenta1)
    user.add_account(cuenta2)
    user.getTotalAccount()
    user.display_user_balance()
    user.make_deposit(1, 50)
    user.make_withdrawal(2, 10)
    user.display_user_balance()
コード例 #13
0
ファイル: test.py プロジェクト: martasobota/python-examples
shape3 = Shape("asdas", "asdas", "red")
shape4 = Shape(x, y, "red")

distance = shape.distance(shape2)
print(distance)

# Shape.printShape(s) # zle

shape.printShape()  # dobrze 
print(shape.printShape())
shape.distance(shape2)


print("------- TEST BankAccount -------")

ba = BankAccount(123456)
ba.printInfo()
ba.depositCash(130.0)

ba.depositCash(1)
ba.printInfo()

# ba.depositCash("123")

sto = 100.00
ba.withdrawtCash(sto)
ba.printInfo()

ba.withdrawtCash(100)
ba.printInfo()
コード例 #14
0
ファイル: tests.py プロジェクト: mimirerelala/HackBulgaria
from bankAccount import BankAccount

account = BankAccount("Rado", 0, "$")
print(account)#'Bank account for Rado with balance of 0$'
account.deposit(1000)
account.balance()#1000
print(str(account))#'Bank account for Rado with balance of 1000$'
print(int(account))#1000
print(account.history())#['Account was created', 'Deposited 1000$', 'Balance check -> 1000$', '__int__ check -> 1000$']
print(account.withdraw(500))#True
print(account.balance())#500
print(account.history())#['Account was created', 'Deposited 1000$', 'Balance check -> 1000$', '__int__ check -> 1000$', '500$ was withdrawed', 'Balance check -> 500$']
print(account.withdraw(1000))#False
print(account.balance())#500
print(account.history())#['Account was created', 'Deposited 1000$', 'Balance check -> 1000$', '__int__ check -> 1000$', '500$ was withdrawed', 'Balance check -> 500$', 'Withdraw for 1000$ failed.', 'Balance check -> 500$']
rado = BankAccount("Rado", 1000, "BGN")
ivo = BankAccount("Ivo", 0, "BGN")
print(rado.transfer_to(ivo, 500))#True
print(rado.balance())#500
print(ivo.balance())#500
print(rado.history())#['Account was created', 'Transfer to Ivo for 500BGN', 'Balance check -> 500BGN']
print(ivo.history())#['Account was created', 'Transfer from Rado for 500BGN', 'Balance check -> 500BGN']
コード例 #15
0
ファイル: test.py プロジェクト: martasobota/python-examples
from advancedCalculator import AdvancedCalculator
from bankAccount import BankAccount


r = 2
radius = AdvancedCalculator.computeCircleRadius(r)
print("radius = {}".format(radius))

print("--- BankAccount ---")

ba = BankAccount()
ba.printInfo()

ba2 = BankAccount()
ba2.printInfo()

ba3 = BankAccount()
ba3.printInfo()

print("---")
ba.depositCash(100)
ba.printInfo()
ba2.printInfo()

コード例 #16
0
    ]
    return month_names[int(month) - 1]


def change_date(input_date):
    content = input_date.split('/')
    print(content)
    print(content[0] + ' ' + get_month_name(content[1]) + ' ' + content[2])


#print(x)
#execute(-200)
#simple_interest(760000, 10.6, 0.5)
#change_date('9/10/2020')

account = BankAccount('Mayokun Oke', '2122500103', '387247272092', 100000)
print('Account Name: ', account.get_account_name())
print('Account Number: ', account.get_account_number())
print('BVN:', account.get_bvn())
print('Balance:', account.get_balance())
account.deposit(23500)
print('Balance:', account.get_balance())
account.withdraw(500000)
#account.withdraw(123000)

pupil = Student('Mayokun Oke', 'Female', 'PDS/APP/1999079', 'Engineering')
pupil.add_subject("Mathematics")
pupil.add_subject("English")
pupil.add_subject("Chemistry")
pupil.add_subject("Physics")
print('Subject: ', pupil.get_subjects())
コード例 #17
0
#! usr/bin/env python
"""
bankAccount.py

by David Baylor on 8/27/19

uses python 3

The UI to bankAccount.py.

Could you import a whole folder if you wanted classes from multiple files?

"""

from bankAccount import BankAccount  # imports the class
myAccount = BankAccount()
myAccount.vew()

choice = ""

while choice != "D":
    choice = input("""
    What would you like to do?
    A) Vew account balance.
    B) Make a deposit. 
    C) Withdraw money.
    D) Quit
    """)

    choice = choice.upper()
コード例 #18
0
ファイル: user.py プロジェクト: radek1982/CDPython
 def open_account(self, account=BankAccount()):
     self.accounts.append(account)
     return self