Assignment 1
Assignment 1
Create a superclass BankAccount and two subclasses CheckingAccount and SavingsAccount. All
the bank accounts should support getBalance, deposit and withdraw methods. Follow the
below detailed specifications for each class.
BankAccount:
- transferMoney method that transfers money from this bank account to other bank account.
This method takes two arguments (BankAccount otherAccount, double amount).
CheckingAccount:
- Constant instance fields for ALLOWED_TRANS and TRANS_FEE. Allow for 2 free transactions
and $3 for additional transaction.
- chargeFees that charges transaction fee if any to the account at the end of the period.
SavingsAccount:
- Instance field interestRate that holds the interest rate for period.
- addCompoundInterest method that adds the interest for the current period to the account
balance. Deposit the interest to the account. (Use this formula to calculate interest = balance *
interestRate / 100.0 )
TransactionsDriver:
- End of program
Sample Output:
At the end of these transactions the bank accounts should have the below balances: