Question: Properties: account _ number - B 1 , B 2 , B 3 assigned automatically by code in the _ _ init _ _ method.
Properties:
accountnumber B B B assigned automatically by code in the init method. Thus, the first bank account created gets B the second B etc. Note that this is assigned automatically by code you write within theinit method for this class.
balance. An initial value for the balance is specified when the bank account object is created.
overdraftaccount The bank account object that provides overdraft protection, initially set to None. See setoverdraftaccount method below.
Behavior or methods:
init initializer constructor for the bank account objects.
str returns a string representation of an account in the form account number:balance. For example, B:
depositamount deposit the specified amount into this bank account object
setoverdraftaccountotheraccount Register otheraccount as the overdraft account for this account. For example, asetoverdraftaccounta assigns account a as the overdraft account for account a
withdrawamount withdraw the specified amount from this bank account object. See setoverdraftaccount method above. If a withdrawal causes the balance of this account to become negative, a while loop must be used to repeatedly transfer money by using the transfer method from the overdraft account in $ increments till the balance becomes positive. For example, if a withdrawal causes the balance to become two transfers of $ will be made to correct the negative balance.
transferamount otheraccount transfer specified amount from this account to otheraccount. For example, atransfer a transfers $ from account a to account a This method must utilize the withdraw and deposit methods already defined in the class, ie it must be implemented as a withdraw from one account followed by a deposit into the other.
Add a method to the class such that, assuming b and b are bank account objects, b b returns a new bank account object whose balance is the sum of the balances of b and b
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
