SHARE
TWEET

Untitled

a guest Mar 20th, 2017 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.ArrayList;
  2.  
  3. public class Bank {
  4.     ArrayList<Account> accounts = new ArrayList<Account>();
  5.            
  6.     public void addNewAccount(Account a) {
  7.         accounts.add(a);
  8.     }
  9.    
  10.     public Account getAccountByIndex(int idx) {
  11.         return accounts.get(idx);
  12.     }
  13.    
  14.     public ArrayList getAccounts() {
  15.         return accounts;
  16.     }
  17.    
  18.     public String toString() {
  19.         String accountList = "";
  20.         for(int i=0; i<=accounts.size(); i++) {
  21.             accountList = accounts.get(i).toString() + "\n";
  22.            
  23.         }
  24.         return accountList;
  25.     }
  26.    
  27. }
RAW Paste Data
Top