Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Now create another class named SavingsAccount. This should be a subclass of BankAccount. A SavingsAccount should have an interest rate that is specified in its

Now create another class named SavingsAccount. This should be a subclass of BankAccount. A SavingsAccount should have an interest rate that is specified in its constructor. Furthermore, there should be a method, addInterest, that deposits interest into account, based on the account balance and interest rate.

Create another subclass of BankAccount named CheckingAccount. A CheckingAccount should keep track of the number of transactions made (deposits and withdrawals). Name this field transactionCount. Also, the set fee for transactions is three dollars, so create a static final field, TRANSACTION_FEE, that is set to 3.0. Finally, create a method, deductFees, that deducts fees from the account balance based on the number of transactions. This method should reset the transactionCount to zero.

Now make a class BankAccountTest with a main method to test the above classes. Create a SavingsAccount with zero balance, a 1% interest rate, and a name of your choice. Also create a CheckingAccount with a $500 initial balance and a name of your choice. Deposit $1000 into the SavingsAccount. Withdraw $100 from the CheckingAccount. Now transfer $200 from the SavingsAccount to the CheckingAccount. Print out both accounts. Now add interest to theSavingsAccount and deduct fees from the CheckingAccount. Print out both accounts and make sure the balances are as expected.

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 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions