// A subclass of the savings account class. // This example illustrates adding instance variables and // overriding a method in the parent class. public class AccountCmp extends Account { // instance variables // also inherits name, balance, interestrate static double minbalance = 6000.; static double penalty = 20.; // constructor method is same as parent public AccountCmp (String n, double b) { super (n, b); } // override one method // also inherits getname, getbalance, withdraw, and deposit public double monthactivity() { if (balance < minbalance) balance -= penalty; double newbalance = balance * (double)(Math.pow (1 + (interestrate/12)/30, 30)); double interest = newbalance - balance; balance = newbalance; return interest; } }