An Object Showdown

Is it possible to demonstrate any compelling benefits with such a simple object? Perhaps a few test scenarios will illustrate some clear benefits. With such a simple object, it is trivial to code a "normal" set of procedures that deliver the main functionality that the Loan class delivers. To summarize, the only thing the Loan class does is remember who it is (LoanNumber), how much it is for (Princi-palAmount), what interest rate it carries (InterestRate), how long it is for (Term), and finally, what the loan payment is (Payment).

For the first scenario, you'll just loop through a list ofloans and calculate payment amounts. Figure 11.5 shows the worksheet I created for this example. Notice that it contains a named range "LoanListStart" that refers to cell A1.

Figure 11.5

A list of loans for testing the Loan object

E3 Microsoft Office Excd 2003 Beta - Chapter 11 Examples,kIs

IBS HI.

Edt Vbtw Insert Farinât Tools Data

Whdow Holp

- 9 X

: £

i 10 . B I = =

äSI% •

'A h£! 2J • & • A z

:

I-J

■ --'J ■ ■ jä ■ IJ 1

E2

V

ft

A

B

c

D E [

E x

1 2

Loan Number t

Term EO

rite res: Rata B.00%

Principal Am aunt P a j menl 25,000 Q i

3

2

3S

7.75%

43,000

£

3

36

7.50%

12.000

3

4

46

7 33%

35,000'

B

S

72

6.25%

53,500

7

0

3

H *

> >l

laoans / 3ieetl / 5hee!3 1

f

>J

I

Listing 11.4 presents a procedure that loops through loan data on a worksheet and calculates the payment amount associated with each loan.

0 0

Post a comment