Home
ITSOBank class
This class implements the logic for the interface Bank and contains all the business logic related to the manipulation of customers, accounts and transactions in the ITSOBank application. Example | 2 shows some of the relevant Java source code in simplified format of the ITSOBank class.
Example 8-2 ITSOBank class
public class ITSOBank implements Bank {
public ITSOBank() {this.setCustomers(new HashMap<String, Customer>());this.setAccounts(new HashMap<String, Account>());this.setCustomerAccounts(new HashMap<String, ArrayList<Account>>());this.initializeBank();}private void initializeBank() {Customer customer1 = new Customer("111-11-1111", "MR", "Ueli","Wahli");this.addCustomer(customer1);(...)}public void updateCustomer(String ssn, String title, String firstName,String lastName) throws InvalidCustomerException {this.searchCustomerBySsn(ssn).updateCustomer(title, firstName,lastName);}public void withdraw(String accountNumber, BigDecimal amount)throws InvalidAccountException, InvalidTransactionException {this.processTransaction(accountNumber, amount,itso.rad75.bank.ifc.TransactionType.DEBIT);}......}
ibm.com/redbooks