📄 txtest.java
字号:
/* * * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved. * * This software is the proprietary information of Sun Microsystems, Inc. * Use is subject to license terms. * */import java.util.*;import com.sun.ebank.ejb.tx.*;import com.sun.ebank.ejb.exception.*;import com.sun.ebank.util.*;import java.rmi.RemoteException;public class TxTest { private TxController txController; public TxTest(TxController txController) { this.txController = txController; runTests(); } private void runTests() { try { txController.withdraw(20.00, "ATM Withdrawal", "5001"); txController.deposit(40.00, "Interest Payment" ,"5001"); txController.makeCharge(100.00, "Duke's Book Store" ,"5003"); txController.makePayment(50.00, "Duke's Book Store" ,"5003"); txController.transferFunds(20.00, "Transfer Funds", "5003", "5001"); txController.transferFunds(60.00, "Transfer Funds", "5001", "5002"); // get an account's transactions for the specified // time period Date today = new Date(); Date startDate = DateHelper.addDays(today, -30); Date endDate = DateHelper.addDays(today, 1); ArrayList txList = txController.getTxsOfAccount(startDate, endDate, "5001"); printArray(txList); } catch (RemoteException ex) { System.err.println ("Caught a RemoteException. " + ex.getMessage()); } catch (AccountNotFoundException ex) { System.err.println ("Caught a AccountNotFoundException. " + ex.getMessage()); } catch (InsufficientFundsException ex) { System.err.println ("Caught a InsufficientFundsException. " + ex.getMessage()); } catch (InsufficientCreditException ex) { System.err.println ("Caught a InsufficientCreditException. " + ex.getMessage()); } catch (IllegalAccountTypeException ex) { System.err.println ("Caught a IllegalAccounTypeException. " + ex.getMessage()); } // catch } // runTests private void printArray(ArrayList list) { Iterator i = list.iterator(); while (i.hasNext()) { TxDetails details = (TxDetails)i.next(); System.out.println(); DisplayDetails.print(details); } } // printArray} // class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -