| Line 114: |
Line 114: |
| | transAmt = currentTransAmt; | | transAmt = currentTransAmt; |
| | } | | } |
| − | public String toString() //Modify like CD example | + | public String toString() |
| | { | | { |
| | NumberFormat fmt = NumberFormat.getCurrencyInstance(); | | NumberFormat fmt = NumberFormat.getCurrencyInstance(); |
| Line 152: |
Line 152: |
| | private float balance; | | private float balance; |
| | private float totalServiceCharge; //Changed from double | | private float totalServiceCharge; //Changed from double |
| − | private int transCount; //static? | + | private int transCount; |
| | private Transaction[] tList; | | private Transaction[] tList; |
| | | | |
| − | public void addTrans(int transID, int transNumber, float transAmt) //change to float | + | public void addTrans(int transID, int transNumber, float transAmt) |
| | { | | { |
| | if(transCount == tList.length) | | if(transCount == tList.length) |
| Line 161: |
Line 161: |
| | | | |
| | tList[transCount] = new Transaction(transID, transNumber, transAmt); | | tList[transCount] = new Transaction(transID, transNumber, transAmt); |
| − | //balance += transAmt;
| |
| | transCount++; | | transCount++; |
| | } | | } |
| − | public void getTrans(int checkOrDeposit) //void? | + | public void getTrans(int checkOrDeposit) |
| | { | | { |
| | int i; | | int i; |
| − | for(i = 0;i < tList.length;i++) | + | for(i = 0;i < transCount;i++) |
| | { | | { |
| | if(tList[i].getTransID() == checkOrDeposit) | | if(tList[i].getTransID() == checkOrDeposit) |
| Line 174: |
Line 173: |
| | } | | } |
| | } | | } |
| − | System.out.println("NOT DONE");
| |
| | } | | } |
| − | public int getTransCount() //static | + | public int getTransCount() |
| | { | | { |
| | return transCount; | | return transCount; |
| Line 203: |
Line 201: |
| | public CheckingAccount() //Needed? | | public CheckingAccount() //Needed? |
| | { | | { |
| | + | balance = 0; |
| | + | totalServiceCharge = 0; |
| | tList = new Transaction[10]; | | tList = new Transaction[10]; |
| | transCount = 0; | | transCount = 0; |
| − | //totalCost = 0.0;
| |
| | } | | } |
| | public CheckingAccount(float currentBalance, float currentServiceCharge) | | public CheckingAccount(float currentBalance, float currentServiceCharge) |
| Line 213: |
Line 212: |
| | tList = new Transaction[10]; | | tList = new Transaction[10]; |
| | transCount = 0; | | transCount = 0; |
| − | //totalCost = 0.0;
| |
| | } | | } |
| − | public String toString() //Modify like CDCollection example | + | public String toString() |
| | { | | { |
| | NumberFormat fmt = NumberFormat.getCurrencyInstance(); | | NumberFormat fmt = NumberFormat.getCurrencyInstance(); |
| Line 261: |
Line 259: |
| | public static JFrame frame; | | public static JFrame frame; |
| | public static CheckingAccount account = null; | | public static CheckingAccount account = null; |
| − | //Figure out how to deal with below500 stuff | + | public static boolean below500 = false; |
| | | | |
| | public static void main(String[] args) | | public static void main(String[] args) |
| Line 272: |
Line 270: |
| | frame.setVisible(true); | | frame.setVisible(true); |
| | } | | } |
| − | public static void doTransactions() //static? | + | public static void doTransactions() |
| | { | | { |
| − | //Some flags need to be moved to global as well
| |
| | int tCode = 0; | | int tCode = 0; |
| − | int doAnother;
| |
| | String stringBalance, stringTCode, stringTransAmt, message; | | String stringBalance, stringTCode, stringTransAmt, message; |
| | float balance, transAmt, charge, balanceBeforeCharge; | | float balance, transAmt, charge, balanceBeforeCharge; |
| − | boolean below500 = false;
| |
| | //boolean done = false; | | //boolean done = false; |
| | charge = 0.00f; | | charge = 0.00f; |
| Line 428: |
Line 423: |
| | "Final Balance : $" + fmt.format(account.getBalance()); | | "Final Balance : $" + fmt.format(account.getBalance()); |
| | JOptionPane.showMessageDialog(null, message); | | JOptionPane.showMessageDialog(null, message); |
| − | doAnother = JOptionPane.NO_OPTION;
| |
| | //done = true; | | //done = true; |
| − | //When 0 chosen, terminate program | + | System.exit(0); //Modify to window listener? |
| | } | | } |
| | } | | } |