View Single Post
Old 10-22-2004, 11:11 AM   #1 (permalink)
verdell32
Registered User
 
verdell32's Avatar
 
Join Date: Oct 2004
Posts: 35
verdell32 is on a distinguished road
Talking Problem with Mortgage.cpp

I am trying to figure out what I am missing or doing wrong here are the spec's

Write Program that calculates and displays this information about a home mortgage.

This is how the finished product should look in the "Command Prompt"(Input Information)

Enter Price of house
Enter down payment
Annual Interest Rate
Number of years to pay




Code:
// Program Documentation //////////////////////////////////////////////////////
//
// Project Name  : MORTGAGE
//
// Source File   : mortgage.cpp
//
// Programmed By :
//
// Last Revision : 10/21/2004
//
// Version Number: 0.1
//
// Program Description ////////////////////////////////////////////////////////
//
// This program
//
///////////////////////////////////////////////////////////////////////////////

// Include Files //////////////////////////////////////////////////////////////
#include <iostream.h>
#include <conio.h>
#include <math.h>

// Function Prototypes ////////////////////////////////////////////////////////

// Program Mainline ///////////////////////////////////////////////////////////

int main( )
{
  double homePrice;
  double downPayment;
  double yearlyInterestRate;
  int termInYears;
  double monthlyInterestRate;
  double termInMonths;
  double tempTerm;
  double loanAmount;
  double monthlyPayment;
  double loanCost;


  //get input
  cout << "Enter Price of house:";
  cin >> homePrice;
  cout << "Enter down payment:";
  cin >> downPayment;
  cout << "Enter annual interest rate:";
  cin >> yearlyInterestRate;
  cout << "Enter pay off in years:";
  cin >> termInYears;


  // Calculate values
    monthlyInterestRate = yearlyInterestRate / 100;
    monthlyPayment = termInYears * 12;
    loanCost = (loanAmount *
               pow(monthlyInterestRate + 1, tempTerm)
               * monthlyInterestRate)/( pow(monthlyInterestRate + 1,
               tempTerm) - 1 );

    // Output results 
    		cout << homePrice << endl;
         cout<< loanAmount  << " with an interest rate of " << endl;
         cout<< yearlyInterestRate << " and a " << termInYears
         << " year mortgage, " << endl;          
    cout << " your monthly payments are $" << endl;

   getch();
   return 0;
}//endmn
"And the output should look like this in the (Console application)

==============================
Price fo house
Down Payment
Amount of loan
Annual Interest Rate
Pay off in years
Number of payments
Monthly Payment
Cost of Loan
===============================

Last edited by Valmont; 10-22-2004 at 11:42 AM.
verdell32 is offline   Reply With Quote