/LoanCalculator

       Loan Payment Calculator
 
           Principle:  _______.__ (amount of money being loaned)
       Interest rate:  ___.____   (12% = 12)
  Number of payments:  ____.      (15 years of monthly payments = 180)
                                  (30 years of monthly payments = 360)

     Monthly Payment:  _______.____


           Press ESC to quit

/*
// Copyright (c) 2005 by Curtis Krauskopf
//                       http://www.decompile.com
// This is a DataFlex character-mode style program.
// Permission to use, copy, modify, distribute and sell this software for any
//     purpose is hereby granted without fee, provided that the above copyright
//     notice appears in all copies of this file and in all modified versions
//     of this file.
// The author makes no representations about the suitability of this
//     software for any purpose. It is provided "as is" without express
//     or implied warranty.
// Created:  February 19, 2005 by Curtis Krauskopf (cdk)
//                                http://www.decompile.com
//
// This program calculates the monthly payment for a loan.
// When the user provides the amount of money being loaned (the principle),
// the interest rate and the number of payments, the program calculates
// what the monthly payment amount that will pay off the loan in the number
// of months specified by the user.
//

name nPrinciple
name nInterestRate
name nPayments
name nMonthlyPayment

repeat
  number numerator
  number denominator
  number base exponent
  number intRate
  number paymentsPerYear

  accept nPrinciple
  accept nInterestRate
  accept nPayments
  
  move 12 to paymentsPerYear    
  movenum (nInterestRate / 100) to intRate
  movenum (intRate * nPrinciple / paymentsPerYear) to numerator
  movenum (-1 * paymentsPerYear * (nPayments / number(12))) to exponent
  movenum ((intRate / paymentsPerYear) + 1.0) to base
  movenum (1.0 - (base ^ exponent)) to denominator
  movenum (numerator / denominator) to nMonthlyPayment
loop

keyproc key.escape
abort
