O'Reilly logo

Java™ How to Program, Seventh Edition by P. J. Deitel - Deitel & Associates, Inc., H. M. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required