I have some basic c++ stuff sitting around that i will post here, i will have to write lesson 1 again as i lost it. I am also going to start on some new ones. These lessons are intended for novices.
Hi. I just wanna know if the formula for the monthly payment in lesson3 is correct? supposedly the answer would be 1072.30 when i use the test inputs right? I tried it in a calculator and my answer is 140.52. My program also produce the same result... I wonder if that is correct? here's my code:
#include <iostream.h>
#include <stdlib.h>
#include <math.h>
int main()
{
char surname[20],firstname[20];
double monthlyPmt,rate,term,LoanAmt,Frate,Fterm;
cout<<"This program will compute for our monthly payment.";
cout<<"\nKindly fill up necessary fields.";
cout<<"\nSurname :";
cin>>surname;
cout<<"First name :";
cin>>firstname;
cout<<"Loan Amount :";
cin>>LoanAmt;
cout<<"Term (years) :";
cin>>term;
cout<<"Rate :";
cin>>rate;
Frate= (rate/100)/12;
Fterm = term*12;
monthlyPmt =( Frate*(pow(1+Frate,Fterm)) / pow(1+Frate,Fterm-1) ) * LoanAmt;
cout<<monthlyPmt;
system("PAUSE");
return 0;
}