//package cis223.Bank; import java.util.*; import myIO.*; public class Bank { Vector accounts = new Vector(); // vector of accounts public Bank() { } public void addNewAccount() { String name = IO.getString("Enter name"); //String address1 = IO.getString("Enter street and number"); //String address2 = IO.getString("Enter city, state, and zip"); //String telNum = IO.getString("Enter telephone number"); String address1 = "XXX"; String address2 = "YYY"; String telNum = "215"; int age = IO.getInt("Enter age"); double balance = IO.getDouble("Enter starting balance"); String[] choices = {"check senior", "check adult", "check student", "save senior", "save adult", "save student"}; int accountNum = IO.getInt("Enter account number"); int accountKind = IO.getChoice("Choose new account type", choices); Account acc; switch (accountKind) { case 0 : Senior senCust = new Senior(name, address1, address2, telNum, age); acc = new CheckingAccount(); acc.openAccount(senCust, accountNum, balance); accounts.addElement(acc); break; } // end switch } public void deleteAccount() { } public int findAccount(int accountNum) { } public void deposit(String kind) { int acNum = IO.getInt("Enter account number"); int index = findAccount(acNum); if (index < 0) IO.displayResult("no account found"); else { Account acc = ((Account) accounts.elementAt(index)); if (acc.getClass().getName().equals(kind)) { double amount = IO.getInt("Enter deposit amount"); Transaction trans = new Transaction("deposit", acNum, amount); acc.deposit(trans); acc.addTransaction(trans); } else { IO.displayResult("Account #" + acNum + " is not a " + kind + "\nTransaction not processed"); } } } public void withdraw(String kind) { } public void showAccount() { } }