Skip to main content
ICT
Lesson A5 - Designing and Using Classes
 
Main   Previous Next
 

F. Using Classes page 8 of 11

  1. Using the CheckingAccount class is best demonstrated by writing a program that solves a specific problem. We want to study the following scenario:

An interest bearing checking account is created with a balance of $1,000. For two years in a row, add 2.5% interest. How much money is in the account after two years?

  1. Two classes are required: the CheckingAccount class that was developed in the preceding sections, and a second class called CheckingTester. The main method of the CheckingTester class constructs a CheckingAccount object, adds the interest twice, then prints out the balance.

 

Main   Previous Next
Contact
 © ICT 2006, All Rights Reserved.