import java.util.*; import java.awt.*; // // Monthly account - superclass of all accounts with monthly payment // of interest // abstract class MonthlyAccount extends Account { MonthlyAccount(String accountname, double accountinterest, TextArea out) throws NoNameException { super(accountname,accountinterest,out); } // for subclasses of MonthlyAccount the interest is only computed // on the 1st of the month void ComputeInterest() { double interestPay; if(date==1) { // monthly payments are made only on the 1st of the month interestPay=Math.abs(balance)*interest/100/12; if(balance<0) // ie. if the account is overdrawn balance-=interestPay; else balance+=interestPay; } } }