J.6. Class DepositSlot
Class DepositSlot (Fig. J.5) represents the deposit slot of the ATM. This class simulates the functionality of a real hardware deposit slot. DepositSlot has no attributes and only one methodIsDepositEnvelopeReceived (lines 710)which indicates whether a deposit envelope was received.
Figure J.5. Class DepositSlot represents the ATM's deposit slot.
1 // DepositSlot.cs 2 // Represents the deposit slot of the ATM 3 public class DepositSlot 4 { 5 // indicates whether envelope was received (always returns true, 6 // because this is only a software simulation of a real deposit slot) 7 public bool IsDepositEnvelopeReceived() 8 { 9 return true; // deposit envelope was received 10 } // end method IsDepositEnvelopeReceived 11 } // end class DepositSlot |
Recall from the requirements document that the ATM allows the user up to two minutes to insert an envelope. The current version of method IsDepositEnvelopeReceived simply returns true immediately (line 9), because this is only a software simulation, so we assume that the user inserts an envelope within the required time frame. If an actual hardware deposit slot were connected to our system, method IsDepositEnvelopeReceived would be implemented to wait for a maximum of two minutes to receive a signal from the hardware deposit slot indicating that the user has indeed inserted a deposit envelope. If IsDepositEnvelopeReceived were to receive such a signal within two minutes, the method would return TRue. If two minutes were to elapse and the method still had not received a signal, then the method would return false.
J 7 Class Account
|