Prg420 Week2
Essay by 24 • May 24, 2011 • 442 Words (2 Pages) • 1,033 Views
import java.io.*;
import java.util.*;
import java.text.*;
public class Calculator //begins Calculator class
{
public static void main(String[] args) throws IOException
{
//declares variables and defines hard coded values
double principal = 200000;
double interest = 0.0575;
int term = 30;
//prints an explanation of the calculations to be performed
//and the data that will be displayed by he program
System.out.println("nThis program will calculate and display the monthly " +
"nmortgage payment needed to fully amortize a $200,000.00 loan " +
"nover a term of 30 years at a 5.75% interest rate.");
System.out.println();
System.out.println();
//calculations to find monthly interest rate and payment amount
double monthlyInterest = interest / 12;
double payment = (principal * monthlyInterest)
/ (1 - Math.pow(1/ (1 + monthlyInterest), term * 12));
...
...