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

Answer:

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

  //constructors
  . . . .

  // methods
  . . . .

  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:


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.