Guest User

Untitled

a guest
Jul 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. /*
  2. * This class creates the program to test the banking classes.
  3. * It creates a set of customers, with a few accounts each,
  4. * and generates a report of current account balances.
  5. */
  6.  
  7. import banking.domain.*;
  8. import banking.reports.*;
  9.  
  10. public class TestBanking {
  11.  
  12. public static void main(String[] args) {
  13. Bank bank = Bank.getBank();
  14. Customer customer;
  15. CustomerReport report = new CustomerReport();
  16.  
  17. // Create several customers and their accounts
  18. bank.addCustomer("Jane", "Simms");
  19. customer = bank.getCustomer(0);
  20. customer.addAccount(new SavingsAccount(500.00, 0.05));
  21. customer.addAccount(new CheckingAccount(200.00, 400.00));
  22.  
  23. bank.addCustomer("Owen", "Bryant");
  24. customer = bank.getCustomer(1);
  25. customer.addAccount(new CheckingAccount(200.00));
  26.  
  27. bank.addCustomer("Tim", "Soley");
  28. customer = bank.getCustomer(2);
  29. customer.addAccount(new SavingsAccount(1500.00, 0.05));
  30. customer.addAccount(new CheckingAccount(200.00));
  31.  
  32. bank.addCustomer("Maria", "Soley");
  33. customer = bank.getCustomer(3);
  34. // Maria and Tim have a shared checking account
  35. customer.addAccount(bank.getCustomer(2).getAccount(1));
  36. customer.addAccount(new SavingsAccount(150.00, 0.05));
  37.  
  38. // Generate a report
  39. report.generateReport();
  40. }
  41. }
Add Comment
Please, Sign In to add comment