Complete Class

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

Answer:

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:

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

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

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

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

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

    balance =  balance - amount - charge  ;
  }

}

QUESTION 16:

Now that the coding is complete, are we done?