M.12. Class Deposit

Class Deposit (Fig. M.11) extends Transaction and represents a deposit ATM transaction. Recall from the class diagram of Fig. 10.22 that class Deposit has one attribute amount, which line 6 implements as an int field. Lines 7–8 create reference-type attributes keypad and depositSlot that implement the associations between class Deposit and classes Keypad and DepositSlot modeled in Fig. 10.21. Line 9 declares a constant CANCELED that corresponds to the value a user enters to cancel. We will soon discuss how the class uses this constant.

Figure M.11. Class Deposit represents a deposit ATM transaction.
 1  // Deposit.java
 2  // Represents a deposit ATM transaction
 3
 4  public class Deposit extends Transaction
 5  {
 6 private double ...

Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.