OPPapers.com Essay Index >> Miscellaneous >> Prg420 Week2
We have many free term papers and essays on Prg420 Week2. We also have a wide variety of research papers and book reports available to you for free. You can browse our collection of term papers or use our search engine.
prg420 week2. import java.io.*; import java.util.*; import java.text.*;
public class Calculator //begins Calculator class { public ...
Submitted by zaidalin79 on January 27, 2008
Category: Miscellaneous
Words: 442 | Pages: 2
Views: 95
Popularity Rank: 88,508
Average Member Grade: N/A (Add a Comment / Grade this Paper)
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));
NumberFormat usFormat = NumberFormat.getCurrencyInstance(Locale.US);
//outputs monthly payment amount based on calculations
System.out.println("Based on a 30 year mortgage loan in the amount of " +
"\n$200,000.00,at an annual interest rate of 5.75%, the monthly" +
"\npayment needed to fully amortize the loan is: " + usFormat.format(payment));
System.out.println();
System.out.println();
}//end main
}//end class Calculator
You must Login to view the entire paper.
If you are not a member yet, Sign Up for free!