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.

Page 2 of 2 FirstFirst 12
Results 26 to 39 of 39

Thread: Monthly mortgage payment calculator

  1. #26
    Member
    Join Date
    Mar 2013
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Monthly mortgage payment calculator

    ok when i run this program it asks questions i enter the following
    house price = 1000
    down payment = 50
    interest rate = .05
    number of payments 30
    top equation: double tempTop = ((housePrice - downPayment) * (annualInterestRate/12));
    bottom equation: double tempBottom = ((1-(1+(Math.pow(annualInterestRate/12, -numberofPayments)))));
    double monthlyPayment = (tempTop / tempBottom);



    the end results are top equation = 3.9583333333333335
    end result for bottom equation = -2.548808761537613E71 negative number
    mortgage payment = top/bottom = -1.5530130753887556E-71 negative number

  2. #27
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Monthly mortgage payment calculator

    You need to continue breaking the compound expressions down into single expressions and printing their values.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #28
    Member
    Join Date
    Mar 2013
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Monthly mortgage payment calculator

    what will that accomplish i dont get what your trying to do i showed you the formula and i showed you how i broke it down what else needs to be done?

  4. #29
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Monthly mortgage payment calculator

    what else needs to be done
    You need to find where the error is in that compound expression.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #30
    Member
    Join Date
    Mar 2013
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Monthly mortgage payment calculator

    its in bottom expression but i dont know how to fix it thats problem i can break it down all day long but something is wrong please help me!!!!!!!!!!

  6. #31
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Monthly mortgage payment calculator

    i can break it down all day long but something is wrong
    There aren't an infinite number of subexpressions so I expect you can do it in a few minutes.

    You need to verify that all the subexpressions are working correctly.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #32
    Member
    Join Date
    Mar 2013
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Monthly mortgage payment calculator

    i dont know how to break this line down any further
     
    double tempBottom = ((1-(1+(Math.pow(annualInterestRate/12, -numberofPayments)))));
    on paper sure in java no clue

  8. #33
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Monthly mortgage payment calculator

    Start on the inside and work out: aIR/12, Math.pow()
    If you don't understand my answer, don't ignore it, ask a question.

  9. #34
    Member
    Join Date
    Mar 2013
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Monthly mortgage payment calculator

    forget it im struggling for hours now and all your doing is asking me more questions. thanks for nothing its much appreciated

  10. #35
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Monthly mortgage payment calculator

    Sorry, if you didn't find someone to do your work for you. I thought you were interested in learning programming techniques. Among those techniques is debugging. That's what I've been suggesting that you do with your code so YOU could find what the problem with YOUR code is.

    Good luck.
    If you don't understand my answer, don't ignore it, ask a question.

  11. #36
    Member
    Join Date
    Mar 2013
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Monthly mortgage payment calculator

    i apologize just frustrated I think i figured it
    double tempBottom = ((1-(Math.pow(1+(annualInterestRate/12), -numberofPayments))));
    my 1+ was in the wrong spot, Norm you were right when i broke it completely down i saw it thanks

    --- Update ---

     
     
    import java.util.Scanner;
     
    	public class Project1 {
    	public static void main(String[] args) {
    		Scanner input = new Scanner(System.in);
     
    		System.out.println("Enter the price of the house: ");
    		double housePrice = input.nextDouble();
    		System.out.println("Enter the down payment: ");
    		double downPayment = input.nextDouble();
    		System.out.println("Enter the annual interest rate: ");
    		double annualInterestRate = input.nextDouble();
    		System.out.println("Enter the number of payments: ");
    		double numberofPayments = input.nextDouble();
     
     
    		double tempTop = ((housePrice - downPayment) * (annualInterestRate/12));
    		double tempBottom = ((1-(Math.pow(1+(annualInterestRate/12), -numberofPayments))));
    		double monthlyPayment = (tempTop / tempBottom);
     
    		System.out.println( "The price of the house is: " + housePrice);
    		System.out.println( "Your down payment is : " + downPayment);
    		System.out.println( "Your annual interest rate is :" + annualInterestRate);
    		System.out.println( "Your number of payments are: " + numberofPayments);		
    		System.out.println( "Your monthly payment is: " + monthlyPayment);
    		System.out.println( "");
    		System.out.println( "Top of equation equals: " + tempTop);
     
    		System.out.println( "Bottom of equation equals: " + tempBottom);
     
     
     
    	}	
    	}

    i think im on track please check

  12. #37
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Monthly mortgage payment calculator

    Glad you are making progress.
    If you don't understand my answer, don't ignore it, ask a question.

  13. #38
    Junior Member
    Join Date
    Feb 2013
    Location
    N. Ireland
    Posts
    29
    Thanks
    2
    Thanked 6 Times in 6 Posts

    Default Re: Monthly mortgage payment calculator

    Quote Originally Posted by iamgonge View Post
    i dont know how to break this line down any further
     
    double tempBottom = ((1-(1+(Math.pow(annualInterestRate/12, -numberofPayments)))));
    on paper sure in java no clue
    Norm is trying to help you to help yourself. You can't learn something if people just give you the answer. Especially in programming. Now look at this line off code I quoted and look at how the math.pow method works. Do you see a problem.

    Norm is correct when he tells you to "continue breaking the compound expressions down into single expressions". This helps you to find if your calculations are wrong and were they are going wrong. For example :
    3*(35+(50/5)) - to break this down
    3*(35+10)
    3*45
    ANS = 135

  14. #39
    Member
    Join Date
    Mar 2013
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Monthly mortgage payment calculator

    thank you

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Need help with my code for calculating monthly payment on a loan
    By Marcella74 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 25th, 2012, 09:26 AM
  2. Arrays for mortgage calc
    By kprofgold in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 22nd, 2012, 01:01 AM
  3. Monthly Mortage Payment Calculator
    By lockdown in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 17th, 2011, 11:54 PM
  4. Mortgage Calculator Issue
    By coyboss in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 5th, 2011, 09:12 AM
  5. Problem in implementing mortgage calculator
    By American Raptor in forum AWT / Java Swing
    Replies: 1
    Last Post: April 1st, 2009, 02:09 PM