Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Use JAVA) 13. Add a transfer method to the BankAccount class from the previous exercises. Your method should move money Trom the current bank account

image text in transcribed(Use JAVA)

13. Add a transfer method to the BankAccount class from the previous exercises. Your method should move money Trom the current bank account to another account. The method accepts two parameters: a second BankAccount to accept the money, and a real number for the amount of money to transfer. There is a $5.00 fee for transferring money, so this much must be deducted from the current account's balance before any transfer. The method should modify the two BankAccount objects such that "this" current object has its balance decreased by the given amount plus the $5 fee, and the other account's balance is increased by the given amount. If this account object does not have enough money to make the full transfer, transfer whatever money is left after the $5 fee is deducted. If this account has under $5 or the amount is O or less, no transfer should occur and neither account's state should be modified. The Tollowing are some example calls to the method: BankAccount bennew BankAccount) ben.deposit (80.00); BankAccount hal- new BankAccount ) hal.deposit (20.00) ben.transfer(hal, 20.00):11 ben $55, hal $40 (ben -$25, hal +$20) ben.transfer (hal, 10.00): 11 ben $40, hal $50 (ben -$15, hal +$10 hal.transfer (ben, 60.00) I/ben $85, hal 0 (ben +$45, hal -$50)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

=+1 Why are local employment laws important to IHRM?

Answered: 1 week ago

Question

=+ Are some laws more important than others? If so, which ones?

Answered: 1 week ago