So I need to find the monthly payment for a motgage and I can't seem to find what is wrong with my equation, someone help please!
monthlyPayment = taxRate * loanAmount * ((Math.pow(1+taxRate, months)) / (Math.pow((1+taxRate, months)-1)));
Printable View
So I need to find the monthly payment for a motgage and I can't seem to find what is wrong with my equation, someone help please!
monthlyPayment = taxRate * loanAmount * ((Math.pow(1+taxRate, months)) / (Math.pow((1+taxRate, months)-1)));
Can you explain why you think there is something wrong?Quote:
what is wrong with my equation
Where did you get the equation? Can you copy the full text of the equation you are trying to code and paste it here. If there are errors, Please copy the full text of the error message and paste it here.
Oh I guess I didn't really state that clearly. We have to calculate a monthly mortgage and my professor gave me this equation we have to use and its
monthly payment = rate x amount x (1+rate)^months / ((1+rate)^months)-1
Attachment 2340
and this is the equation I used in my program
monthlyPayment = taxRate * loanAmount * (((Math.pow(1+taxRate, months)) / (Math.pow((1+taxRate, months)-1)));
I get the red bar under it and the only error says " ')' expected " error
here is a pic of my code if that helps
Attachment 2341
Please copy full text of the compiler's error message and paste it here.Quote:
I get the red bar under it
The message should show the source with a ^ under the location of the error.
Here is a sample from the javac compiler:
Code :
TestSorts.java:138: cannot find symbol symbol : variable var location: class TestSorts var = 2; ^
How do I do that? I hover my mouse over the red bar and it says ')' unexpected
--- Update ---
Compiling 1 source file to E:\MortgageCaculation\build\classes
E:\MortgageCaculation\src\mortgagecaculation\Mortg ageCaculation.java:44: error: ')' expected
monthlyPayment = taxRate * loanAmount * (((Math.pow(1+taxRate, months)) / (Math.pow((1+taxRate, months)-1)));
1 error
E:\MortgageCaculation\nbproject\build-impl.xml:926: The following error occurred while executing this line:
E:\MortgageCaculation\nbproject\build-impl.xml:268: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)
I don't see the ^ that points to the location of the error.
Check that the ()s are correctly positioned. Perhaps add some spaces to isolate different parts of the equation so you can easily see if the ()s are in the correct places.
trust me ive been trying. I use netbeans so maybe its different but i cant find anywhere a compile button.
I don't know anything about your IDE. I use the javac command to compile my java programs. In many cases it gives better error messages than IDEs do.
--- Update ---
Did you check the ()s as I suggested?