J.1. ATM Case Study Implementation

This appendix contains the complete working implementation of the ATM system that we designed in the nine "Software Engineering Case Study" sections in Chapters 1, 39 and 11. The implementation comprises 655 lines of C# code. We consider the 11 classes in the order in which we identified them in Section 4.11 (with the exception of TRansaction, which was introduced in Chapter 11 as the base class of classes BalanceInquiry, Withdrawal and Deposit):

We apply the guidelines discussed in Section 9.17 and Section 11.9 to code these classes based on how we modeled them in the UML class diagrams of Fig. 11.21 and Fig. 11.22. To develop the bodies of class methods, we refer to the activity diagrams presented in Section 6.10 and the communication and sequence diagrams presented in Section 8.14. 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 3.10.

We conclude the discussion by presenting a test harness (ATMCaseStudy in Section J.13) that creates an object of class ATM and starts it by calling its Run method. Recall that we are developing a first version of the ATM system that runs on a personal computer and uses the keyboard and monitor to approximate the ATM's keypad and screen. Also, we simulate the actions of the ATM's cash dispenser and deposit slot. We attempt to implement the system so that real hardware versions of these devices could be integrated without significant code changes. [Note: For the purpose of this simulation, we have provided two predefined accounts in class BankDatabase. The first account has the account number 12345 and the PIN 54321. The second account has the account number 98765 and the PIN 56789. You should use these accounts when testing the ATM.]

J 2 Class ATM

Категории