hi guys. its me again.
after going thru my prblm i was able to get thru a few of the kinks. however, i still am
having issues with the mathematical statements.

my assognment is to to create a program that will calciulate the monthly payment along with the loan and intersest amount. this is how it must look like:

Loan Amount: \$10000
Annual Interest Rate: 12%
Number of Payments: 36
Monthly Payments: \$332.14
Amount Paid Back: \$11957.15
Interest PaidL \$1957.15

now, the the data u see is just an example, it is not permanent because the user should be able to input any amount and get the appropiate amount

the formula for monthly payment is:

Payment = Rate * (1+ Rate)^N / ((1 + Rate)^N -1) * L

where Rate is the MONTHLY INTEREST (so basically i made annual/12) and N is number of payments and L is the amount of the loan. I wrote my program and started to do the monthly payment equation. however, as i checked it with the data from the book, (as my teacher advised to do so) my monthly payment came out as 10000. what am i doing wrong? btw, i have yet to learn complex shortcuts, so we are suppose to keep it simple.

here is my code:

``````#include <iostream>
#include <cmath>
using namespace std;
int main ()

{

double L, annual, n, payment, rate, total;

cout << "Enter the loan amount --> ";
cin >> L;
cout << "Enter the annual interest rate as a percentage --> ";
cin >> annual;
cout << "Enter the number of payments --> ";
cin >> n;
cout << "The result is" << endl;
cout << "Loan Amount: \$" << L << endl;
cout << "Annual Interest Rate:" << annual << " %" << endl;
cout << "Number of Payments:" << n << endl;

rate = annual/12;
payment = (rate * pow(1.0 + rate, n))/(pow(1.0 + rate, n) -1) * L;
cout << "Monthly Payment: \$" << payment << endl;

return 0;

}``````
2
Contributors
1
2
Views
9 Years
Discussion Span
Last Post by WaltP

hi guys. its me again.
after going thru my prblm i was able to get thru a few of the kinks. however, i still am
having issues with the mathematical statements.

And you still haven't bothered to read the Forum Rules yet because
1) you have a terrible title
2) you keep using web-speak
3) you can't get CODE tags right

The Rules are there so we can help you better and to allow more people to understand what you are talking about. Mny pp dn spk wb, so spk English.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.