Due Date:
Make a copy of each transaction
file, account file, program (with new names of course).
Change
Transaction files as following:
File 1: File
2:
@ Harry 10 @ Harry -6
$ Barry 10 $ Barry -10
$Harry 5 $ Larry 5
$Barry –3 $ Larry 10
$Harry 5 report 2
report
$Harry @ Harry -4
@
Harry 9
@ means Checking Account.
$ means Savings Account.
Advice: Don’t store type as new variable. Leave it in the name. Check it when opening account to determine
which class to instantiate. Break it off
in the to-String() methods.
Rule: Do not look at it when calling Withdraw() or Deposit() methods. Polymorphism will pick the correct overridden
method. MAGIC !!!
You can cast just to (Account).
Checking Account – extends Account of
#17. Keep track of last check #
written. Writes a check when money is
Withdrawn (Acct#, Name, Amount) . Remember to save the
check # in the account file.
Savings Account – extends Account of #17,
has a constant check #0. Deposit method
prints “Thank you and name”.
The Chart now has:
# Type Name Balance Last Check #
Type
is a word – not @ or $
Last
check number is blank for savings accounts.
You
don’t have to copy these exact headings.
Feedback
is appreciated. I hope you designed #17
well. Learn chapter 13. Think. Think.
Think. Make and test one change
at a time.
Hand
in your Program, 3 files, Output.