cardreader.java
来自「含有uml的多个实例及实例的java源码。」· Java 代码 · 共 61 行
JAVA
61 行
/* * ATM Example system - file CardReader.java * * copyright (c) 2001 - Russell C. Bjork * */ package atm.physical;import atm.ATM;import banking.Card;import simulation.Simulation;/** Manager for the ATM's card reader. In a real ATM, this would * manage a physical device; in this simulation, it uses classes * in package simulation to simulate the device. */ public class CardReader{ /** Constructor * * @param atm the ATM that owns this card reader */ public CardReader(ATM atm) { this.atm = atm; } // In a real ATM, code would be needed to sense insertion of a card into the // slot and notify the ATM - simulated in this case by a button in the GUI /** Read a card that has been partially inserted into the reader * * @return Card object representing information on the card if read * successfully, null if not read successfully */ public Card readCard() { return Simulation.getInstance().readCard(); } /** Eject the card that is currently inside the reader. */ public void ejectCard() { Simulation.getInstance().ejectCard(); } /** Retain the card that is currently inside the reader for action by the * bank. */ public void retainCard() { Simulation.getInstance().retainCard(); } /** The ATM to which this card reader belongs */ private ATM atm; }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?