Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How to create mortgage code in Java?

Design and implement a program that calculates and displays the mortgage payment amount given the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. In first iteration of the program, hard code the principal equals 200,000 dollars, the term equals 30 years, and the annual interest rate equals 5.75 percent.

Update:

/*

Title: Mortgage

Description: This program will calculate the mortgage:

- Amount

- Terms

- Interest

- use methods

Author:

Date: 11/07/2010

Version: 1.0

*/

//importing java packages

import java.text.DecimalFormat;

//class declaration

public class mortgage

{

//Main method

//Every Java program must have this

public static void main(String args[])

{

// Declare and construct variables

double interest,payment;

int ammount,term;

DecimalFormat decimalPlaces=new DecimalFormat("0.00");

/*Below is the hard coded values used to calculate the

monthly mortgage payment. */

interest=.0475; //The interest percentage is 4.75%.

ammount=400000; //The principle of the loan is $400,000.

term=30; //The term of the loan is 30 years.

// This is the formula ued

payment=(ammount*((interest/12)/(1-Ma

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    Yahoo answers isn't your human coding machine.

Still have questions? Get your answers by asking now.