import java.util.*; import java.awt.*; // // Loan account class // public class LoanAccount extends MonthlyAccount { LoanAccount(String accountname, double loan, double accountinterest, TextArea out) throws NoNameException { super(accountname, accountinterest,out); balance= -loan; } void Deposit(double amount) throws NegativeAmountException { if(amount<0) throw new NegativeAmountException(new String(Name())); // update balance balance+=amount; } // a call to this method will raise an exception (no extra credit allowed) void Withdraw(double amount) throws NoExtraCreditException { throw new NoExtraCreditException(new String(Name())); } void ComputeInterest() { if(balance<0) super.ComputeInterest(); // no interest is offered for the overpaid loans } // Update method is normally called once every day void Update() { date=date%30+1; ComputeInterest(); } public void Output() { Double doubleNo=new Double(0); output.appendText("Loan account: "+Name()+"\nbalance: "+doubleNo.toString(Balance())+ "\nmonthly interest: "+doubleNo.toString(interest)+"%\n"); } }