class account { protected int bal; protected void chargefee() { bal -= 3; } public void deposit(int amt) { bal += amt; this.chargefee(); } public int inquiry() { return bal; } public account(int b0) { bal = b0; } } class savingsaccount extends account { private double interest; // interest rate // overrides chargefee: protected void chargefee() { bal -= 1; } // cheaper than superclass! // public void deposit(int amt) { bal += amt; chargefee(); } // Why did we just redefine something that looks IDENTICAL?!! public savingsaccount(int bal, double intr) { super(bal); // calls constructor of superclass interest = intr; } } public class accounts2 { public static void main(String[] args) { savingsaccount myaccount = new savingsaccount(100,0.02); myaccount.deposit(50); System.out.println(myaccount.inquiry()); } }