CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2010
    Posts
    10

    Figuring out interest

    Here is what I have below...

    #include <iostream> // This program calculates the interest on a loan and the
    using namespace std; // total amount of the loan after interest is added.

    int main()
    { // Variables.
    int preInterestLoan, interest, numOfPayments;
    float monthlyPayments, amountPaidBack, interestPaid;

    preInterestLoan = 10000; // Loan amount before interest.
    interest = preInterestLoan * .01;

    numOfPayments = 36; // 3 year loan.

    return 0;
    }

    I still need to figure out how to calculate and display the monthlyPayments which are 332.14, the amountPaidBack which will total to $11,957.15, and the interestPaid which will obviously be $1,957.15. Any help as to how I can add them into the program? Thanks in advance.

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: Figuring out interest

    Quote Originally Posted by JerBear24 View Post
    I still need to figure out how to calculate and display the monthlyPayments which are 332.14, the amountPaidBack which will total to $11,957.15, and the interestPaid which will obviously be $1,957.15. Any help as to how I can add them into the program? Thanks in advance.
    How did you derive those figures? You must have applied some formula, so all you have to do is write the same formula in your program.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #3
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: Figuring out interest

    for display you can use

    eg;
    Code:
     cout << "The monthly payments is " << monthlyPayments ;

  4. #4
    Join Date
    Sep 2010
    Posts
    10

    Re: Figuring out interest

    yeah I was giving these numbers, I was so confused because I kept doing the math and the numbers never added up. I guess I just display them and there is no math.

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Figuring out interest

    You may want to look up how interest is calculated. It isn't that simple. try a search for "amortization formula".

  6. #6
    Join Date
    May 2002
    Posts
    1,435

    Re: Figuring out interest

    There's still something missing from your question. Simple loan amortization is relatively easy to calculate (for example, see http://www.hughchou.org/calc/formula.html). But using the standard formula results in a monthly payment of 282.08 rather than 332.14 which can be verified by any online mortgage calculator.

    Obviously, in a real mortgage there are other factors that will modify the monthly payment amount but you haven't said anything about those factors so we must assume the standard calculation.

    You need to provide more information about where the figures you were given came from - a web site? a book? homework?.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured