Kim wants to buy a car. Help kim compute the monthly payment on a loan, given the loan amount, the annual percentage rate of interest, and the number of monthly payments. The program should allow kim to input the loan amount, interest rate, and how many payments she wants to make. It should then compute and display the monthly payment in a raptor program

Respuesta :

#include <iostream>

#include <math.h>

using namespace std;

int main()

{

   double Payment, LoanAmt, InterestRate, MonthlyRate;

   int NumberMonths;

   cout<<"LOAN INTEREST CALCULATOR:"<<endl;

   cout<<"Enter the loan amount: ";

   cin>>LoanAmt;

   cout<<endl<<"Enter the interest amount: ";

   cin>>InterestRate;

   MonthlyRate = InterestRate/1200;

   InterestRate = InterestRate / 100;

   cout<<endl<<"Enter the number of years: ";

   cin>>NumberMonths;

   NumberMonths = NumberMonths * 12;

   Payment = (LoanAmt * MonthlyRate * pow ((1.0 + MonthlyRate), NumberMonths)) / pow((1.0 + MonthlyRate), NumberMonths -1; //monthly payment formula

   cout<<endl<<"The monthly payment is: "<<Payment; //display monthly payment

   return 0;

}