Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started