[Payment = (InterestRate*LoanAmount/12)/(1.0 – Math.pow(((InterestRate/12)+1.0), (-(12*Years))))].
The final output can be displayed when all the inputs and calculations are complete.
Java applet for computing loan payments embedded in an HTML page. The user can use the applet to compute the loan payments.
[
import java.applet.Applet; import java.awt.Button; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Label; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.NumberFormat;
/* * <applet code="Loan calculator" width=280 height=200> </applet> */
public class LoanCalculator extends Applet implements ActionListener {
TextField rateText, paymentText, periodText,amountText, totalpaymentText ;
Button doIt;
double loanamount; // original princial
double intRate; // interest rate
double numYears; // length of loan in years
double totalpayment; /* * Number of payments per year. You could allow this value to be set by the * user. */ final int payPerYear = 12;
NumberFormat nf;
public void init() { // Use a grid bag layout. GridBagLayout gbag =