In particular, because Bailey Bros. is always pleased to get deposits (after all, you never know when there will be a run on the bank), they waive the ATM fee for deposits. (Ask that drunken souse Uncle Billy about things that can go wrong when you're making a deposit.) But they pass on the $1.50 charge for each ATM savings account withdrawal to the customer. They allow each ATM savings account holder two free ATM withdrawals per month, so the $1.50 per-withdrawal charge kicks in for all withdrawals starting from the third one of the month.
Your task is to create a class ATMSavingsAccount that
represents a Bailey Bros. ATM savings account. It should support the
following methods:
deposit method.
withdraw method.
getBalance method.
transfer method. (From the point of view of
withdrawal charges, a transfer counts as a withdrawal from the
account being transferred from.)
toString method.
addPeriodicInterest method. Along with adding
the interest, this method also performs the deductions for
having more than two withdrawals in the period. (First add
interest, then deduct the charges.) Of course, it also resets
the number of withdrawals in the period back to 0.
Your ATMSavingsAccount class should be a subclass of one
of the classes from the lecture of October 26. I'll leave it to
you to decide which class to make its direct superclass. Note
that some of the above methods can be simply inherited from the
superclass, and some you will have to write yourself.
Needless to say, you may not modify any of the classes
BankAccount, CheckingAccount,
SavingsAccount, or TimeDepositAccount.
You should also modify the AccountTest class to test your
ATMSavingsAccount class. Hint: It's particularly easy to
just change Harry's checking account to an ATM savings account.
Hand in source listings for the ATMSavingsAccount and
AccountTest classes, along with output from a test run.