Question: Add a method called transfer ( ) to the BankAccount class, that takes in an amount and destinationAccount as input and transfer the funds from
Add a method called transfer to the BankAccount class, that takes in an amount and destinationAccount as input and transfer the funds from current account to destination account.
This method should return the balance of the current account after the transfer, also should check for the sufficient balance in current account before proceeding the transfer and if there is insufficient balance return an error message "Insufficient balance".
Modify the BankAccountTest class, so that it calls the transfer method and prints the balance after transfer.
Make sure that the transfer method updates the balance of both the current account and the destination account.
Make sure that the transfer method updates the balance of both the current account and the destination account.
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
