J.3. Class Screen

Class Screen (Fig. J.2) represents the screen of the ATM and encapsulates all aspects of displaying output to the user. Class Screen simulates a real ATM’s screen with the computer monitor and outputs text messages using standard console output methods Console.Write and Console.WriteLine. In the design portion of this case study, we endowed class Screen with one operation—DisplayMessage. For greater flexibility in displaying messages to the Screen, we now declare three Screen methods—DisplayMessage, DisplayMessageLine and DisplayDollarAmount.

Method DisplayMessage (lines 5–7) takes a String as an argument and prints it to the screen using Console.Write. The cursor stays on the same line, making this method appropriate for displaying ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.