Section J.6. Class DepositSlot


J.6. Class DepositSlot

Class DepositSlot (Fig. J.5) represents the deposit slot of the ATM. Like the version of class CashDispenser presented here, this version of class DepositSlot merely simulates the functionality of a real hardware deposit slot. DepositSlot has no attributes and only one methodIsDepositEnvelopeReceived (lines 68)that indicates whether a deposit envelope was received.

Figure J.5. Class DepositSlot represents the ATM's deposit slot.

 1  ' DepositSlot.vb 2  ' Represents the deposit slot of the ATM 3  Public Class DepositSlot 4     ' indicates whether envelope was received (always returns true, 5     ' because this is only a software simulation of a real deposit slot) 6     Public Function IsDepositEnvelopeReceived() As Boolean 7        Return True ' deposit envelope was received 8     End Function ' IsDepositEnvelopeReceived 9  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 7), because this is only a software simulation, and 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.



Visual BasicR 2005 for Programmers. DeitelR Developer Series
Visual Basic 2005 for Programmers (2nd Edition)
ISBN: 013225140X
EAN: 2147483647
Year: 2004
Pages: 435

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net