
/**
 * SimpleLoan provides a concrete implementation of a Loan object.
 */
public class SimpleLoan extends Loan
{
    /**
     * This constructor simply calls the contructor from the Loan class.
     */
    public SimpleLoan(String name, double rate, int years, double amount)
    {
        super(name, rate, years, amount);
    }

    /* Return the loan type as a string */
    public String toString()
    {
        return "Simple Interest Loan";
    }

    /**
     * Calculate the monthly payment for a SimpleLoan
     */
    public void calcMonthlyPayment()
    {
        double adjMonthlyRate = m_interestRate / 100.0 / 12.0;
        double lengthInMonths = m_length * 12;
        m_monthlyPayment = (m_principal * (adjMonthlyRate * lengthInMonths + 1)) / lengthInMonths;
    }
}
