In this project your will create a simple bank applications that creates accounts for customers....

In this project your will create a simple bank applications that creates accounts for customers and performs simple actions such as deposit, withdraw, and applying annual interest. The objective is to use object oriented programming and inheritance in the program.

You shall define a Customer class. A customer has a first name, last name, and social security number. You must override __str__ operator to return the customer first name, last name and ssn.

You shall define a BankAccount base class. A BankAccount has a customer, account number, and a balance.  A bank account can be opened with any amount of initial deposit.  For each bank account, a 10 digit random account number must be created.  Bank account shall define the following methods: deposit, withdraw. applyAnnualInterest. Note that the amount withdrawn cannot exceed the balance. If it does, the amount should not be withdrawn and insufficient funds should be reported. You must override __str__ operator to return a pretty string representation of a bank account.

You shall define two types of account subclasses: Checking Account and Saving Account. These subclasses inherit from the BankAccount base class. Each account accrues interest.  A saving account accrues 5% fixed interest and a checking account accrues 2% for any amount in excess of $10000 (For example, if there is $11000 in the checking account, the interest is only applied to $1000).

You can use the “main” shown below to test your application. The expected output is also provided.

 

def main():

    alin = Customer('Alin', 'Smith', '111-11-1111')
    mary = Customer('Mary', 'Lee', '222-22-2222')
    alinAccnt = CheckingAccount(alin)
    maryAccnt = SavingAccount(mary)

    alinAccnt.deposit(20000)
    print(alinAccnt)
    alinAccnt.withdraw(5000)
    print(alinAccnt)
    alinAccnt.annualInterest()
    print(alinAccnt)


    maryAccnt.deposit(10000)
    print(maryAccnt) 
    maryAccnt.withdraw(15000)
    print(maryAccnt)
    maryAccnt.applyAnnualInterest()
    print(maryAccnt) 

 

=================== This is the expected output =======================

Alin Smith (ssn: 111-11-1111) , account number 1702660396, balance $20000
Alin Smith (ssn: 111-11-1111) , account number 1702660396, balance $15000
Alin Smith (ssn: 111-11-1111) , account number 1702660396, balance $15100.0
Mary Lee (ssn: 222-22-2222) , account number 2552619508, balance $10000
Mary Lee (ssn: 222-22-2222) , insufficent funds to withdraw $ 15000
Mary Lee (ssn: 222-22-2222) , account number 2552619508, balance $10000
Mary Lee (ssn: 222-22-2222) , account number 2552619508, balance $10500.0
Powered by