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?
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.
Last modified: December 12, 2022
Back to Constructors