The number of times each individual object has been used.
(If this is not clear, look at the class definition again to see that
the variable useCount
is part of each object,
and that each object has its own method incrementUse()
which increments its own variable.)
main()
Here is a main()
that shows these ideas:
class CheckingAccount { private String accountNumber; private String accountHolder; private int balance; private int useCount = 0; CheckingAccount( String accNumber, String holder, int start ) { . . . . } private void incrementUse() { . . . . } int currentBalance() { . . . . } void processDeposit( int amount ) { . . . . } void processCheck( int amount ) { . . . . } void display() { . . . . } } class CheckingAccountTester { public static void main( String[] args ) { CheckingAccount bobsAccount = new CheckingAccount( "999", "Bob", 100 ); CheckingAccount jillsAccount = new CheckingAccount( "111", "Jill", 500 ); bobsAccount.processCheck( 50 ); bobsAccount.processDeposit( 150 ); bobsAccount.processCheck( 50 ); jillsAccount.processDeposit( 500 ); jillsAccount.processCheck( 100 ); jillsAccount.processCheck( 100 ); jillsAccount.processDeposit( 100 ); bobsAccount.display(); jillsAccount.display(); } }