Package Banking

Examples of Banking.BankException


  }

  public void withdraw(int amount) throws BankException {
    if(balance - amount < 0) {
      LOG.warn("not allowed to overdraw, throwing AccountException");
      throw new BankException("overdraw not allowed!");
    }
    LOG.info("accountNumber: " + accountNumber + " withdraw: " + amount);
    balance -= amount;
  }
View Full Code Here


 
  public void closeAccount(String accountNumber) throws BankException {
    AccountImpl account;
    if ((account = internal_findAccount(accountNumber)) == null) {
      LOG.warn(MSG_NO_SUCHACCOUNT + accountNumber);
      throw new BankException(MSG_NO_SUCHACCOUNT + accountNumber);
    }
    LOG.info("Closing account with number: " + accountNumber);
    account.close();
    accounts.remove(accountNumber);
  }
View Full Code Here

  public CurrentAccount createCurrentAccount(String accountNumber, int loanLimit) throws BankException {
    CurrentAccount account = null;

    if (internal_findAccount(accountNumber) != null) {
      LOG.warn(MSG_ACCOUNT_ALREADYCREATED + accountNumber);
      throw new BankException(MSG_ACCOUNT_ALREADYCREATED + accountNumber);
    }
    try {
      CurrentAccountImpl accountImpl = new CurrentAccountImpl(accountNumber, loanLimit);
      accounts.put(accountNumber, accountImpl);
     
View Full Code Here

  public SavingsAccount createSavingsAccount(String accountNumber, float interestRate) throws BankException {
    SavingsAccount account = null;

    if (internal_findAccount(accountNumber) != null) {
      LOG.warn(MSG_ACCOUNT_ALREADYCREATED + accountNumber);
      throw new BankException(MSG_ACCOUNT_ALREADYCREATED + accountNumber);
    }
    try {
      SavingsAccountImpl accountImpl = new SavingsAccountImpl(accountNumber, interestRate);
      accounts.put(accountNumber, accountImpl);
     
View Full Code Here

       
        return account;
       
      } catch (Exception e) {
        LOG.warn(e);
        throw new BankException(MSG_COULDNOT_CREATESTUB + accountNumber);
      }
    } else {
      throw new BankException(MSG_COULDNOT_FINDACCOUNT + accountNumber);
    }
  }
View Full Code Here

  // private helper methods

  public AccountImpl internal_findAccount(String accountNumber) throws BankException {
    if (StringUtils.isEmpty(accountNumber)) {
      throw new BankException(MSG_ACCNO_NOTEMPTY);
    }
    return accounts.get(accountNumber);
  }
View Full Code Here

  }
 
  public void withdraw(int amount) throws BankException {
    if((balance + loanLimit) - amount < 0) {
      LOG.warn("not allowed to overdraw below the loan limit, throwing AccountException");
      throw new BankException("overdraw below the loan limit not allowed!");
    }
    LOG.info("accountNumber: " + accountNumber() + " withdraw: " + amount);
    balance -= amount;
  }
View Full Code Here

TOP

Related Classes of Banking.BankException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.