Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribed

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

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_2

Step: 3

blur-text-image_3

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

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions