999 Bob 120 3 111 Jill 870 4
(Remember those 15 cent service charges per check.)
public
Visibility Modifier
The private
visibility modifier keeps outsiders from looking in.
However,
the access methods are intended for outsiders,
and have to be visible to outsiders in order to be useful.
The public access modifier
explicitly says that a method or variable of an object can
be accessed by code outside of the object.
The public
visibility modifier is usually used for all
access methods and constructors in a class definition.
Most variables are made private
.
Here is a skeleton of the CheckingAccount
class:
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() { . . . . } }