G.1. ATM Case Study Implementation
This appendix contains the complete working implementation of the ATM system that we designed in the "Software Engineering Case Study" sections found at the ends of Chapters 17, 9 and 13. The implementation comprises 877 lines of C++ code. We consider the classes in the order in which we identified them in Section 3.11:
We apply the guidelines discussed in Section 9.12 and Section 13.10 to code these classes based on how we modeled them in the UML class diagrams of Fig. 13.28 and Fig. 13.29. To develop the definitions of classes' member functions, we refer to the activity diagrams presented in Section 5.11 and the communication and sequence diagrams presented in Section 7.12. Note that our ATM design does not specify all the program logic and may not specify all the attributes and operations required to complete the ATM implementation. This is a normal part of the object-oriented design process. As we implement the system, we complete the program logic and add attributes and behaviors as necessary to construct the ATM system specified by the requirements document in Section 2.8.
We conclude the discussion by presenting a C++ program (ATMCaseStudy.cpp) that starts the ATM and puts the other classes in the system in use. Recall that we are developing a first version of the ATM system that runs on a personal computer and uses the computer's keyboard and monitor to approximate the ATM's keypad and screen. We also only simulate the actions of the ATM's cash dispenser and deposit slot. We attempt to implement the system, however, so that real hardware versions of these devices could be integrated without significant changes in the code.