/** * class checking extends account * * John Sloan * January 24,2009 */ public class checking extends account { private boolean overdrawn; /** * construct method * type==0; so type is not needed in the parameters (instructions p.4) */ public checking(String name, int number, double balance) { super(name, number, 0 ,balance); overdrawn = false; } /** * method deposit */ public void deposit(double deposit) { super.deposit(deposit); if(balance>=0){ overdrawn = false; } else{ overdrawn = true; } } /** * method withdrawl */ public void withdrawl(double withdrawl) { double possibleNewBalance = (balance - withdrawl); if( possibleNewBalance < balance * -.10){ overdrawn = true; System.out.println("Error: Insufficient funds to withdraw from this account"); } else { super.withdrawl(withdrawl); } } /** * main method */ public static void main(String [] arg) { checking check = new checking("John Sloan", 65432, 100.0); check.print(); check.deposit(1.00); check.print(); check.withdrawl(120.0); check.print(); check.withdrawl(50.00); check.print(); check.withdrawl(55.00); check.print(); check.withdrawl(10.00); check.print(); } }