Okay, so on this project, we're to calculate the monthly payment of a loan.
I was given the equation:

Here is what I am using for the values in order to calculate the monthly payment:
Principal(P): 100,000
Rate(I) = 5.5% (.055)
Months(N): 180
I get the output
The monthly payment is $5,500.36
Which according to the example I was given, is incorrect...
Example output: $817.08
I have tried calculating it on a calculator (ti-83) and it resulted in the same number (5500.36)
But, when I go to a monthly interest calculator, it gives me the same number as the example (817.08)
So, I am wonder what I am doing wrong in the following code (assume I input the same variables as above)
Code
double monthlyPayment = 0;
double months = (years * 12);
double top = Math.pow(1+rate, months);
top *= rate;
bottom = Math.pow(1+rate, months);
bottom -= 1;
monthlyPayment = (double)loanAmount*(top/bottom);
I don't understand what I am doing wrong to be perfectly honest...