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

Answer:

public class CheckingAccount
{

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

}

Method to Accept a Deposit

Next, implement the method that accepts a deposit. Deposits will be expressed in cents. The method will have one parameter, the number of cents to be added to the balance. The method will not return a value, so its return type will be void.

Since the return type of the method is void, no return statement is needed. When the method is run, it will automatically return to the place where it was called from after the last statement of the method is executed.


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

  //constructors
  . . . .

  // methods
  . . . .

  public void  ( int  )
  {

    balance =   +  ;
  }

}

QUESTION 14:

Complete the method by filling in the blanks.


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