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

Answer:

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

    charge = 15;
  else

    charge = 0;

  balance = balance - amount - charge ;

}

Complete Class

The complete class is defined as:

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

  //constructors
  public CheckingAccount( String accNumber, String holder, int start )
  {
    accountNumber = accNumber ;
    accountHolder = holder ;
    balance       = start ;
  }

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

  public void  processDeposit( int amount )
  {
    balance = balance + amount ; 
  }

  public void processCheck( int amount )
  {
    int charge;
    if ( balance < 100000 )
      charge = 15; 
    else
      charge = 0;

    balance =  balance - amount - charge  ;
  }
  
  public String toString()
  {
     return "Account: " + accountNumber + ";\tOwner: " + accountHolder + ";\tBalance: " + balance ;
  }

}

QUESTION 16:

Now that the coding is complete, are we done?


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