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


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 9 of 9

Thread: ')' and ';' error

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ')' 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. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default 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.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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. #4
    Junior Member
    Join Date
    Oct 2013
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: ')' and ';' error

    here is a pic of my code if that helps

    java 2.jpg

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default 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;
             ^
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Junior Member
    Join Date
    Oct 2013
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default 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.
    If you don't understand my answer, don't ignore it, ask a question.

  8. #8
    Junior Member
    Join Date
    Oct 2013
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: ')' and ';' error

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

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default 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?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Please! Help me to this error "ERROR CANNOT FIND SYMBOL"
    By mharck in forum Object Oriented Programming
    Replies: 8
    Last Post: July 3rd, 2012, 09:20 AM