mortgage

# mortgage - int numberOfPayments; // Total number of...

This preview shows page 1. Sign up to view the full content.

//***************************************************************** // Mortgage Payment Calculator program // This program determines the monthly payments on a mortgage given // the loan amount, the yearly interest, and the number of years. //***************************************************************** / #include <iostream> // Access cout #include <cmath> // Access power function #include <iomanip> // Access manipulators using namespace std; u const float LOAN_AMOUNT = 50000.00; // Amount of the loan const float YEARLY_INTEREST = 0.0524F; // Yearly interest rate const int NUMBER_OF_YEARS = 7; // Number of years / int main() { // local variables float monthlyInterest; // Monthly interest rate
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int numberOfPayments; // Total number of payments float payment; // Monthly payment // Calculate values monthlyInterest = YEARLY_INTEREST / 12; numberOfPayments = NUMBER_OF_YEARS * 12; payment = (LOAN_AMOUNT * pow(monthlyInterest + 1, numberOfPayments) * monthlyInterest)/( pow(monthlyInterest + 1, numberOfPayments) - 1 ); // Output results cout << fixed << setprecision(2) << "For a loan amount of " << LOAN_AMOUNT << " with an interest rate of " << YEARLY_INTEREST << endl << "and a " << NUMBER_OF_YEARS << " year mortgage, " << endl; cout << " your monthly payments are \$" << payment << "." << endl; return 0; } }...
View Full Document

## This note was uploaded on 02/08/2011 for the course CSC 101 taught by Professor Joedzuback during the Spring '11 term at Union County.

Ask a homework question - tutors are online