Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: ')' and ';' error

1. ## ')' and ';' error

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)));

2. ## Re: ')' and ';' error

what is wrong with my equation
Can you explain why you think there is something wrong?
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.

3. ## Re: ')' and ';' error

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

java.PNG

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

4. ## Re: ')' and ';' error

here is a pic of my code if that helps

java 2.jpg

5. ## Re: ')' and ';' error

I get the red bar under it
Please copy full text of the compiler's error message and paste it here.
The message should show the source with a ^ under the location of the error.
Here is a sample from the javac compiler:
```TestSorts.java:138: cannot find symbol
symbol  : variable var
location: class TestSorts
var = 2;
^```

6. ## Re: ')' and ';' error

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)

7. ## Re: ')' and ';' error

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.

8. ## Re: ')' and ';' error

trust me ive been trying. I use netbeans so maybe its different but i cant find anywhere a compile button.

9. ## Re: ')' and ';' error

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?