M.11. Class Withdrawal

Class Withdrawal (Fig. M.10) extends Transaction and represents a withdrawal ATM transaction. This class expands upon the “skeleton” code for this class developed in Fig. 10.24. Recall from the class diagram of Fig. 10.21 that class Withdrawal has one attribute, amount, which line 6 implements as an int field. Figure 10.21 models associations between class Withdrawal and classes Keypad and CashDispenser, for which lines 7–8 implement reference-type attributes keypad and cashDispenser, respectively. Line 11 declares a constant corresponding to the cancel menu option. We will soon discuss how the class uses this constant.

Figure M.10. Class Withdrawal represents a withdrawal ATM transaction.
 1 // Withdrawal.java
 2 // Represents ...

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.