Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 18th, 2010 | Syntax: Java | Size: 0.45 KB | Hits: 38 | Expires: Never
Copy text to clipboard
  1. public class Mortgage {
  2.     public static void main(String[] args)  {
  3.         double myBalance = 200000;
  4.         double myRate = .0575;
  5.         double myTerm = 30;
  6.         double myInterest = 0;
  7.         double myPayment = 0;
  8.  
  9.         myInterest = myRate / (12 * 100);
  10.  
  11.         myPayment = myBalance * (myInterest / (1 - (1 + myInterest) * -12 * myTerm));
  12.  
  13.         System.out.format("Monthly payment is $%.2f%n", myPayment);
  14.         System.out.format("Term of payment is %.0f years. %n", myTerm);
  15.  
  16.     }
  17. }