Service Request Sr-Mf-003, Mortgage Calculator
Essay by people • July 21, 2011 • Essay • 526 Words (3 Pages) • 1,955 Views
package mortgagecalculator;
/**
*
* @author Michele Armstead
* Java Programming I
* PRG/420
* McBride Mortgage Calculator, Part 2
*/
import java.text.*;
public class MortgageCalculator {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//Variables that are used within the program
double principal;
double interestRate;
double totalInterest;
double monthlyPayment;
//Calculates the decimal two places
double d = 1.234567;
DecimalFormat df = new DecimalFormat("#.##");
//Calculations for getting the monthly payment
principal = 200000.0;
interestRate = .0575;
totalInterest = (principal * interestRate) * 30;
monthlyPayment = (principal + totalInterest) / 360;
//Display the results on computer screen
System.out.println("The monthly payment on a 30 year, $200,000 loan with a 5.75% interest rate will be: ");
System.out.println("$" + df.format(monthlyPayment));
//Builds new variables for the next step
double remainingBalance = 0;
double interestPaid = 0;
int lineCount = 10;
remainingBalance = principal - monthlyPayment;
interestPaid = monthlyPayment * totalInterest;
//Begin loop statement plus declares the formula for the loan balance and interest paid
...
...