class CheckingAccount { private String accountNumber; private String accountHolder; private int balance; private int useCount = 0; public CheckingAccount( String accNumber, String holder, int start ) { . . . . } private void incrementUse() { . . . . } public int getBalance() { . . . . } public void processDeposit( int amount ) { . . . . } public void processCheck( int amount ) { . . . . } }
toString()
Method (again)
It would be nice to have the toString()
method
show the use count as well as the other data.
The method must be declared to be public
.
The method must look like this:
public String toString() { }
If your toString()
does not match this method header the compiler will complain.
public class CheckingAccount { private String accountNumber; private String accountHolder; private int balance; private int useCount = 0; . . . . public String toString() { return "Account: " + accountNumber + "\tName: " + accountHolder + "\tBalance: " + balance + "\tUse Count: " + ; } }
Modify the method so that it also prints out the use count.