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

Answer:

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

  //constructors
  . . . .

  // methods
  . . . .

  public void processDeposit ( int amount )
  {

    balance = balance + amount ;
  }

}

Method to Process Checks

If you have the previous test program in a file, it would be nice to add the processDeposit() method and test it. The method to process a check is slightly more complicated:

Here is a sketch of the method:


public void processCheck( int  )
{
  int charge;
  if (  < 100000 )

    charge =  ;
  else

    charge =  ;

  balance =  -  -  ;

}

QUESTION 15:

Fill in the blanks to complete the method. Remember that quantities of money are expressed in cents.


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