Source of Keypad.java


  1: // Keypad.java
  2: // Represents the keypad of the ATM
  3: import java.util.Scanner; // program uses Scanner to obtain user input

  5: public class Keypad
  6: {
  7:    private Scanner input; // reads data from the command line
  8:                          
  9:    // no-argument constructor initializes the Scanner
 10:    public Keypad()
 11:    {
 12:       input = new Scanner( System.in );    
 13:    } // end no-argument Keypad constructor

 15:    // return an integer value entered by user 
 16:    public int getInput()
 17:    {
 18:       return input.nextInt(); // we assume that user enters an integer  
 19:    } // end method getInput
 20: } // end class Keypad  



 24: /**************************************************************************
 25:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 26:  * Pearson Education, Inc. All Rights Reserved.                           *
 27:  *                                                                        *
 28:  * DISCLAIMER: The authors and publisher of this book have used their     *
 29:  * best efforts in preparing the book. These efforts include the          *
 30:  * development, research, and testing of the theories and programs        *
 31:  * to determine their effectiveness. The authors and publisher make       *
 32:  * no warranty of any kind, expressed or implied, with regard to these    *
 33:  * programs or to the documentation contained in these books. The authors *
 34:  * and publisher shall not be liable in any event for incidental or       *
 35:  * consequential damages in connection with, or arising out of, the       *
 36:  * furnishing, performance, or use of these programs.                     *
 37:  *************************************************************************/