1 /**
2 This program tests the Bank class.
3 */
4 public class BankTester
5 {
6 public static void main(String[] args)
7 {
8 Bank firstBankOfJava = new Bank();
9 firstBankOfJava.addAccount(new BankAccount(1001, 20000));
10 firstBankOfJava.addAccount(new BankAccount(1015, 10000));
11 firstBankOfJava.addAccount(new BankAccount(1729, 15000));
12
13 double threshold = 15000;
14 int count = firstBankOfJava.countBalancesAtLeast(threshold);
15 System.out.println("Count: " + count);
16 System.out.println("Expected: 2");
17
18 int accountNumber = 1015;
19 BankAccount account = firstBankOfJava.find(accountNumber);
20 if (account == null)
21 System.out.println("No matching account");
22 else
23 System.out.println("Balance of matching account: "
24 + account.getBalance());
25 System.out.println("Expected: 10000");
26
27 BankAccount max = firstBankOfJava.getMaximum();
28 System.out.println("Account with largest balance: "
29 + max.getAccountNumber());
30 System.out.println("Expected: 1001");
31 }
32 }