BankBeanNotes - Notes on the "Bank Beans" Classes...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Notes on the "Bank Beans" Classes 11-19-09
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Here are comments on the beans we almost finished in the class room last night. The attached bean classes are complete, and the comments below point out code additions we didn't get to in class. You can read the comments below and add the code to your bank bean classes, or you can import the classes into Eclipse. In either case, make sure you are comfortable with the additional code. Account No additions. CashAccount 1. deposit() and withdraw() are synchronized . We can imagine a scenario where a husband and wife, at the bank at the same time with a bunch of transactions to do, have gotten in different teller lines to save time, and end up doing transactions on the same accounts (from different tellers) at the same time. The server (as we usually do) will probably have a thread per teller client, so the processing methods should be synchronized. (This will not cause any noticeable blocking because any waiting is at the account level, not for a deposit-to-any-account.) So this will be rare, but we're being safe! 2. Account data and time stamp is added to the OverdraftException as it is thrown. This constructor form that takes a String (error message) was inherited by our OverdraftException from it's parent Exception. So we didn't have to write any code in our child class OverdraftException. (Child classes of Exception also inherit a constructor form that takes the address of another exception object, so exceptions can be "chained".) 3. BigDecimal data type is used in toString() to ensure that two decimal digits are shown when the float balance value is displayed.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/25/2010 for the course ECE 309 taught by Professor Bowman during the Spring '09 term at N.C. State.

Page1 / 5

BankBeanNotes - Notes on the "Bank Beans" Classes...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online