Mortgagepayment

# Mortgagepayment - for (int i=50000; i<=principle;i++) {...

This preview shows page 1. Sign up to view the full content.

import java.util.*; import java.lang.*; import java.io.*; import java.text.*; import java.math.*; import java.text.DecimalFormat; i public class Mortgagepayment { public static void main(String[] args) { //declaration statements int length=20; double principle =50000.00; //amount borrowed double rate=9.5; d NumberFormat currency=NumberFormat.getCurrencyInstance(); N System.out.println("\t\tMortgage Payment Formula"); System.out.println("\t\tBalance own is \$200,000"); System.out.println("\t\tYearly interest rate is 5.75%"); System.out.println("\t\tThe length of loan is 30 years\n"); S // start of loop to calculate interest paid and balance owe // print statement as balance increment,as interest increment
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for (int i=50000; i<=principle;i++) { // months of payment being decrimented start counter { double y_rate = (rate /100/12); double monthly_payments = principle * ( y_rate / (1 - Math.pow((1+y_rate),-1*(length*12) ) )); System.out.println(" The principle is \$" + currency.format(principle)); System.out.println(" The rate is " + rate); System.out.println("The length is " + length); System.out.println(" The monthly payment is \$" + currency.format(monthly_payments)); c try {Thread.sleep(10);} catch (InterruptedException e){} principle = principle + 10000; length = length + 5; rate = rate + .25; r } System.out.println("Have a nice day"); } }...
View Full Document

## This note was uploaded on 06/17/2011 for the course COMP CS 2301 taught by Professor Staff during the Spring '10 term at Kennesaw.

Ask a homework question - tutors are online