01: /**
02:    A bank consisting of multiple bank accounts.
03: */
04: public class Bank
05: {
06:    /**
07:       Constructs a bank account with a given number of accounts
08:       @param size the number of accounts
09:    */
10:    public Bank(int size)
11:    {
12:       accounts = new BankAccount[size];
13:       for (int i = 0; i < accounts.length; i++)
14:          accounts[i] = new BankAccount();
15:    }
16: 
17:    /**
18:       Deposits money into a bank account.
19:       @param accountNumber the account number
20:       @param amount the amount to deposit
21:    */
22:    public void deposit(int accountNumber, double amount)
23:    {
24:       BankAccount account = accounts[accountNumber];
25:       account.deposit(amount);
26:    }
27: 
28:    /**
29:       Withdraws money from a bank account.
30:       @param accountNumber the account number
31:       @param amount the amount to withdraw
32:    */
33:    public void withdraw(int accountNumber, double amount)
34:    {
35:       BankAccount account = accounts[accountNumber];
36:       account.withdraw(amount);
37:    }
38: 
39:    /**
40:       Gets the balance of a bank account.
41:       @param accountNumber the account number
42:       @return the account balance
43:    */
44:    public double getBalance(int accountNumber)
45:    {
46:       BankAccount account = accounts[accountNumber];
47:       return account.getBalance();
48:    }
49: 
50:    private BankAccount[] accounts;
51: }
52: 
53: