Question: Modify the Account class as follows: a) Replace balance with two instance variables: checkingBalance and savingsBalance and modify the constructor to take two arguments checking



Modify the Account class as follows: a) Replace balance with two instance variables: checkingBalance and savingsBalance and modify the constructor to take two arguments checking and savings. The constructor initializes the two instance variables with the values given by the two arguments. Don't forget to modify the test driver accordingly. b) Replace the credit method with two methods: creditchecking and creditsavings Also, Replace the getBalance method with two methods: getcheckingBalance and getsavingsBalance. Note: the credit operation adds amount to the account c) Add the following two new methods: debitchecking and debitsavings and their corresponding tests. Note: the debit operation subtracts amount from the account. d) Add a method moveFromcheckingTosavings (double amount) Also, Add a method moveFromsavingsTochecking (double amount) You must implement these two methods using creditchecking, creditsavings debitChecking and/or debitsavings as appropriate. Always ensure that the resulting balances do not become negative. If an account is debited with an amount greater than the corresponding balance, then that balance should be left unchanged and the method debitChecking() or debitsavingsshould print a message indicating "Transaction amount exceeded checking balance" or "Transaction amount exceeded savings balance" as appropriate. Modify class AccountTest to test ALL of these methods
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
