• Home
  • About

Snippet IT

IT News, Programming, Internet and Blogging

  • Programming and Scripting
  • Tips and Tricks
  • Software and Hardware
  • New and Happening
You are here: Home / Programming and Scripting / Java: Mortgage Payment Calculator

Java: Mortgage Payment Calculator

July 5, 2009 by Sze Hau 3 Comments

Mortgage Payment Calculator is a tool to calculate the monthly repayment for a fixed rate mortgage. The calculator is written in Java programming language (Java Applet) and can be ran at any web browser. You must have Java plug-in installed on your computer in order to run this web application.

The main purpose of writing this application is so that I can use this tool to calculate the repayments for loan of purchasing a property (mortgage monthly repayment) at any place, any time.

Mortgage Payment Calculator is written base on fixed rate mortgage formula. The formula for fixed rate mortgage is

c = (r / (1 − (1 + r) − N))P0

Where

  • c – fixed monthly payment
  • r – (fixed yearly nominal interest rate) /(100 x 12)
  • P0 – principal
  • N – number of monthly payments (Which is equal to the mortgage terms in years x 12 months)

In Mortgage Payment Calculator, the main function that calculates the fixed monthly payment is as below. The function receives the following parameters: principle, yearly nominal interest rate and terms (in years); and return the monthly repayment value.

public double calculateMonthlyPayment(
  double principle, double rate, int terms
  ) {
  int i;
  int months;
  double mRate;
  double pow;

  mRate = rate / 12 / 100;
  months = terms * 12;
  pow = 1.0;
  for (i = 0; i < months; i++) {
    pow *= (1.0 + mRate);
  }

  return (1.0 - 1.0 /(1 - pow)) * mRate * principle;
}

Mortgage Payment Calculator takes the parameters “price of property” and “down payment” instead of “principle”. In this case (housing loan), the “principle” is actually equals to the “price of property” minus the “down payment”.

You can put this tool on your website too by simply copy the following code and past into your web page source file.

<applet code="MortgagePaymentCalculator.CalculatorApplet" codebase="http://tools.snippetit.com/applet/" archive="MortgagePaymentCalculator.jar" width="320" height="240">
  <param name="property_price" value="200000" />
  <param name="loan_terms" value="30" />
  <param name="interest_rate" value="6.00" />
  <param name="down_payment" value="10000" />
</applet>

The parameters in the applet tag are optional. They serve as the default values for the calculator during application start-up.

More from my site

  • Java: Unlimited Strength Jurisdiction PolicyJava: Unlimited Strength Jurisdiction Policy
  • Java: Static Initializer (Static Constructor)Java: Static Initializer (Static Constructor)
  • Java: How To Select Top N Objects From A ListJava: How To Select Top N Objects From A List
  • Java: How To Implement ungetc in JavaJava: How To Implement ungetc in Java
  • Java: How To Use SQL LIKE Clasue with PreparedStatement?Java: How To Use SQL LIKE Clasue with PreparedStatement?
  • Security: US Cert Warns Users To Disable Java In Web BrowsersSecurity: US Cert Warns Users To Disable Java In Web Browsers

Filed Under: Programming and Scripting Tagged With: applet, calculator, Java

About Sze Hau

Geek. Love programming. Coffee addicted. Married with two children. Working towards financial freedom.

Trackbacks

  1. Monthly Repayment for Housing Loan - szehau’s weblog says:
    July 6, 2009 at 1:23 am

    […] Your can put the little program at your website too. Simple get the code at Mortgage Payment Calculator. […]

  2. Sitewidget.net » Blog Archive » Fixed Rate Mortgage Payment Calculator - Widgets for blog, website, mobile and OS says:
    July 7, 2009 at 11:35 am

    […] Snippetit] Share and […]

  3. Develope a Mortgage Calculator and Win Up to $10000 | Snippet IT says:
    July 22, 2009 at 12:37 am

    […] had developed a mortgage calculator but I think my program (a Java Applet) is too simple and it is not qualfied to enter the contest […]

Leave a Reply Cancel reply

Advertisement

  • Facebook
  • Google+
  • Instagram
  • Twitter

Email News Letter

Sign up to receive updates daily and to hear what's going on with us

Software and Hardware

MD5 and SHA1 Checksum Using Windows

July 5, 2017 By Sze Hau Leave a Comment

Blog Network

  • Personal Fincance Personal Finance – Personal Money Tips, Stock Investment, Small Business and Make Money Online
  • szehau's weblog Life, Internet, Software, Gadgets, Programming and Investments

Snippet IT

This is the place where I want to share anything about information technology.

Search

Recent

  • MD5 and SHA1 Checksum Using Windows
  • MD5 and SHA1 Checksum Using Linux
  • Java: Unlimited Strength Jurisdiction Policy
  • WordPress: How To Change Admin Username
  • Linux: How To Compress And Decompress Folders And Files

Tags

Adsense advertisement advertising apache blog blogging tips C# EGPC error estimation format format Integer Gmail Google Google Adsense Google Chrome Google Search Engine Google search result how to HTTP internet marketing Java JavaScript Linux money password performance PHP programming search engine optimization secure security short URL SQL static constructor String tiny URL Tips and Tricks twitter video Windows Vista Wordpress wordpress plugin wordpress theme Youtube

Copyright © 2025 · Magazine Pro Theme on Genesis Framework · WordPress · Log in