1 /**
2 This program tests the BankAccount class and
3 its subclasses.
4 */
5 public class AccountTester
6 {
7 public static void main(String[] args)
8 {
9 SavingsAccount momsSavings = new SavingsAccount(0.5);
10
11 CheckingAccount harrysChecking = new CheckingAccount(100);
12
13 momsSavings.deposit(10000);
14
15 momsSavings.transfer(2000, harrysChecking);
16 harrysChecking.withdraw(1500);
17 harrysChecking.withdraw(80);
18
19 momsSavings.transfer(1000, harrysChecking);
20 harrysChecking.withdraw(400);
21
22 // Simulate end of month
23 momsSavings.addInterest();
24 harrysChecking.deductFees();
25
26 System.out.println("Mom's savings balance: "
27 + momsSavings.getBalance());
28 System.out.println("Expected: 7035");
29
30 System.out.println("Harry's checking balance: "
31 + harrysChecking.getBalance());
32 System.out.println("Expected: 1116");
33 }
34 }