Hey fox i had a hw problem and im stuck we're supposed to do a payment project and i sort of did the first part but then stuck on the second. Here's what i've done so far...
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
//Program name: Amortize
int main(void)
{
double Amount, Rate, Payment, Z;
int Years, NoPayment;
cout<<"Enter the borrowed amount --->";
cin>>Amount;
cout<<endl<<"Enter the annual interest rate (%) --->";
cin>>Rate;
cout<<endl<<"Enter the pay-back period (in years) --->";
cin>>Years;
/******These statements compute the monthly payment*****/
Rate = Rate / 1200;
NoPayment = Years*12;
Z = exp(-NoPayment * log(1+Rate));
Z = (1 - Z) / Rate;
Payment = Amount / Z;
/*******************************************************/
cout<<endl;
cout<<setprecision(2)<<fixed<<showpoint;
cout<<"The monthly payment is $"<<Payment<<endl;
cin.get(); cin.get();
return 0;
} // Amortize
Now the professor is asking to put the function definition for find payment... im kinda lost... it's due tmw and im stuck... i've marked where i think the code should be put i might be wrong. Would be glad if someone would help me out... Thanks a bunch.
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
/***** Function prototype goes here ******/
//Program name: Amortize
int main(void)
{
double Amount, Rate, Payment, Z;
int Years, NoPayment;
cout<<"Enter the borrowed amount --->";
cin>>Amount;
cout<<endl<<"Enter the annual interest rate (%) --->";
cin>>Rate;
cout<<endl<<"Enter the pay-back period (in years) --->";
cin>>Years;
/******These statements compute the monthly payment*****/
Payment = FindPayment (Amount, Rate, Year);
/*******************************************************/
cout<<endl;
cout<<setprecision(2)<<fixed<<showpoint;
cout<<"The monthly payment is $"<<Payment<<endl;
cin.get(); cin.get();
return 0;
} // Amortize
/*****Insert function definition for FindPayment( ) here*****/