示例#1
0
  public void open_account(boolean save) {
    // actually opens the account
    customer.addAccount(
        starting_account_number,
        save); // addAccount will create a new account based on whether it is savings/checkings

    StringBuilder text = new StringBuilder();
    text.append("<html>Account created!<br>");
    String result = customer.returnInfo();
    String subResult = result.substring(6);
    text.append(subResult);
    String infoText = text.toString();
    jf.displayInfo(infoText);

    transaction_counter++;
    add_interest();
    try {
      saveFile(cust, DBfile);
      saveFile(adminLogs, logFile);
    } catch (IOException e) {
      e.printStackTrace();
    }
    customer = null; // resets the customer and account after each transaction
    pin = null;
  }
示例#2
0
 public void model_transfer(String customerID, String customerPIN) {
   // calls the transfer screen from the RunningFrame class
   validate_info(customerID, customerPIN);
   if (customer != null) {
     jf.dispose();
     jf = new RunningFrame(this);
     String result = customer.returnInfo();
     ArrayList<String> allAccounts = customer.getAllAccounts();
     jf.transferScreen(result, allAccounts);
   }
 }
示例#3
0
  public String close_account(String accountNum) {
    // actually closes the customer's account and returns a dialog box
    customer.removeAccount(accountNum);
    String cusInfo = customer.returnInfo();

    StringBuilder result = new StringBuilder();
    result.append("<html>Deleted account!<br>Updated information:<br>");
    String subCusInfo =
        cusInfo.substring(7, cusInfo.length()); // removes the last html tag from returnInfo()
    result.append(subCusInfo);
    try {
      saveFile(cust, DBfile);
    } catch (IOException e) {
      e.printStackTrace();
    }
    customer = null; // resets the customer and account after each transaction
    pin = null;
    return result.toString();
  }