Question: Properties: account _ number - B 1 , B 2 , B 3 assigned automatically by code in the _ _ init _ _ method.

Properties:
account_number - B1, B2, B3 assigned automatically by code in the __init__ method. Thus, the first bank account created gets B1, the second B2 etc. Note that this is assigned automatically by code you write within the__init__ method for this class.
balance. An initial value for the balance is specified when the bank account object is created.
overdraft_account - The bank account object that provides overdraft protection, initially set to None. See set_overdraft_account 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, B1:200.
deposit(amount)- deposit the specified amount into this bank account object
set_overdraft_account(other_account)- Register other_account as the overdraft account for this account. For example, a1.set_overdraft_account(a3) assigns account a3 as the overdraft account for account a1.
withdraw(amount)- withdraw the specified amount from this bank account object. See set_overdraft_account 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 $50 increments till the balance becomes positive. For example, if a withdrawal causes the balance to become -76.50, two transfers of $50 will be made to correct the negative balance.
transfer(amount, other_account)- transfer specified amount from this account to other_account. For example, a1.transfer(200, a2) transfers $200 from account a1 to account a2. This method must utilize the withdraw and deposit methods already defined in the class, i.e. 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 b1 and b2 are bank account objects, b1+ b2 returns a new bank account object whose balance is the sum of the balances of b1 and b2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!