19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

382 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

FIGURE 12-4 Bank Accounts<br />

The program should use two classes, CTransaction <strong>and</strong> CAccount. The class CTransaction<br />

should have properties for transaction type, amount, paid to, previous balance, new balance,<br />

<strong>and</strong> transaction date. It should have a method that puts the data into a string that can be added<br />

to the Transaction list box, <strong>and</strong> methods that place data into <strong>and</strong> retrieve data from a sequential<br />

file.<br />

The class CAccount, which will have both a checking account <strong>and</strong> a savings account as instances,<br />

should contain a collection of CTransaction objects. In addition, it should have properties<br />

for name (Checking or Savings) <strong>and</strong> balance. It should have methods to carry out a<br />

transaction (if possible), display the list of transactions, <strong>and</strong> to load <strong>and</strong> retrieve the set of<br />

transactions into or from a sequential file. The events InsufficientFunds <strong>and</strong><br />

TransactionCommitted should be triggered at appropriate times. [Hint: In order to make<br />

CAccount object to display a list of transactions, a list box should be passed to a method as<br />

an argument. The method might begin with Public Sub EnumerateTransactions(LB As<br />

ListBox).]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!