gvsu/cs621/proj3/SimpleLoan.java
josh 8818779daf commented, calculating interests
git-svn-id: svn://anubis/gvsu@74 45c1a28c-8058-47b2-ae61-ca45b979098e
2008-03-21 20:48:42 +00:00

31 lines
787 B
Java

/**
* 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;
}
}