Bank Account

mail@pastecode.io avatar
unknown
python
3 years ago
3.1 kB
3
Indexable
Never
class Bank:
    
    branch_list=[]

    def __init__(self, name, code):
        self.name=name
        self.code=code

    def addBranch(self, BranchObject):
        Bank.branch_list=BranchObject

    def removeBranch(self, branch_code):
        for i in range(len(Bank.branch_list)):
            if branch_code in Bank.branch_list[i]:
                del(Bank.branch_list[i])

    def updateInfo(self, newname, newcode):
        self.newname=newname
        self.newcode=newcode

    def getBranch(self, branch_code):
        for i in range (len(Bank.branch_list)):
            if branch_code in Bank.branch_list[i]:
                print(Bank.branch_list[i])

    def getAllBranch(self):
        for i in range(len(Bank.branch_list)):
            print(Bank.branch_list[i][0], Bank.branch_list[i][1])


class BranchObject:

    account_list=[]


    def __init__(self, branch_code, city, bank):
        self.branch_code=branch_code
        self.city=city
        self.bank=bank

    def addAccount(self, accountObj):
        BranchObject.account_list=accountObj

    def removeAccount(self, account_number):
        for i in range(len(BranchObject.account_list)):
            if account_number in BranchObject.account_list[i]:
                del(BranchObject.account_list[i])

    def getAccount(self, account_number):
        for i in range(len(BranchObject.account_list)):
            if account_number in BranchObject.account_list[i]:
                print(BranchObject.account_list[i])

    def updateInfo(self, branch_code, city):
        self.branch_code=branch_code
        self.city=city


class Account:

    BranchObj= BranchObject()

    def __init__(self, acc_no, BranchObj):
        self.acc_no=acc_no
        self.BranchObj=BranchObj

        Account.balance=0

    def  debitAmmount(self, amt):
        Account.balance-=amt


    def creditAmmount(self, amt):
        Account.balance+=amt

    def getBalance(self):
        return Account.balance



class Savings_account:

    customer_obj= Customer()
    def __init__(self, acc_no, branch, min_balance):
        self.acc_no=acc_no
        self.branch=branch
        self.min_balance=min_balance

    def removeCustomer(self):
        pass

    def setCustomer(self, customer_obj):
        pass


class Current_Account:

    

    def __init__(self, acc_no, branch, interest_rate):
        self.acc_no=acc_no
        self.branch=branch
        self.interest_rate= interest_rate


    def setCustomer(self, customer_obj):
        pass
    def removeCustomer(self):
        pass

class Customer:

    id= 123456
    savings_acc= Savings_account()

    def __init__(self,name, address,phone):
        self.name=name
        self.address=address
        self.phone=phone

        Customer.id+=10

    def setSavingsAcc(self, savings_acc):
        pass
    def getSavingsAcc(self):
        pass

    def setCurrentAcc(self, current_acc):
        pass
    def getCurrentAcc(self):
        pass