Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement