go to previous page   go to home page   go to next page

Answer:

public int getBalance()

Other names for the method would also work, of course.


Implementing the Method

The method returns the current balance, which is an int so the return type is int.

The method does not need any input data, so its parameter list is empty.

public class CheckingAccount
{
  // instance variables
  private String accountNumber;
  private String accountHolder;
  private int    balance;

  //constructors
  . . . .

  // methods
  public int getBalance()
  {
     return  ;
  }

}

All getBalance() needs is a statement that returns the balance of the checking account.


QUESTION 13:

Complete the method by filling in the blank.


go to previous page   go to home page   go to next page