1  // A subclass of the Account class.
  2  // This example illustrates adding instance variables and
  3  // overriding a method in the parent class.
  4  //       Nancy McCracken  3/14/97
  5  
  6  
  7  public class AccountCmp extends Account
  8  { // instance variables
  9    static float minbalance = 6000.F;
 10    static float penalty = 20.F;
 11  
 12    // constructor method is same as parent
 13    public AccountCmp (String n, float b)
 14    { super (n, b);  }
 15  
 16    // override one method
 17    public void monthactivity()
 18    { if (balance < minbalance) balance -= penalty;
 19      balance = balance * (float)(Math.pow (1 + (interestrate/12)/30, 30));
 20    }
 21  }
 22