J.8. Class BankDatabase

Class BankDatabase (Fig. J.7) models the bank’s database with which the ATM interacts to access and modify a user’s account information. We determine one reference-type attribute for class BankDatabase based on its composition relationship with class Account. Recall from Fig. 11.19 that a BankDatabase is composed of zero or more objects of class Account. Line 4 implements attribute accounts—an array that will store Account objects—to implement this composition relationship. Class BankDatabase has a parameterless constructor (lines 7–13) that initializes accounts with new Account objects. We create two new Account objects with test data and place them in the array (lines 11–12). Note that the Account constructor has four ...

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.