Little Help with investment and interest rates
Hi. I'm currently stuck here trying to figure out this code I'm trying to construct. I'm trying to write a function that computes future investment value at an interest rate given for a number of years.
so far I've constructed this. Code:
#include <iostream> I believe I should have something that involves/looks like this? The amount invested: 1000 Annual interest rate: 9% Years Future Value 1 1093.8 2 1196.41 ... 29 13467.25 30 14730.57 
Re: Little Help with investment and interest rates
Start by working out how you would do it with a calculator. Then just convert that into C code.
If you can't do the second part, post how you would do it with a calculator and we can help you. 
Re: Little Help with investment and interest rates
Do you mean something like using the InvestAmount as say 1000 and multiply that by 1 and 0.09. That would come out to be 1001.09 right? Errr.

Re: Little Help with investment and interest rates
hrm.

Re: Little Help with investment and interest rates
How are you going to calculate the interest? Will it be once a year just adding 9% of the balance? Will it be monthly (as you seem to refer to this at some point) and if monthly will that be 1/12 of 9%, or the 12th root of (1+9%) (the latter allows for compound interest which will work out at 9%pa, whereas the former will give you more than 9% over the year)?
If it's just once a year adding 9% to the balance, then the calculation is just balance = balance * (1+annualInterestRate) so for example a balance of 1000 becomes 1000*(1+0.09) = 1090. But where did you get the following figures from, and how was 1093.8 calculated? Quote:

Re: Little Help with investment and interest rates
Well I was just asking if it should look something like that.
what should go in for the cout part? 
Re: Little Help with investment and interest rates
Dunno. This is why I asked where you got those values from. 1093.8 obviously isn't 1000*(1+0.09) so that must have been derived by some other calculation.
Just trying an educated guess in a calculator: 1000*(1+0.09/12)^12=1093.806898  that seems close; that's the interest rate divided by 12 and applied monthly as compound, thus leading to 9.38% interest rather than the stated 9%  that may or may not be correct, which is why you need to check where you got 1093.8 from  who gave you that number, or was it a number you worked out yourself? Why do you have a variable called monthlyInterestRate? If you're just calculating the value year on year at 9% per annum, you would use the annual rate directly. Or have you been told to calculate the value monthly? > Well I was just asking if it should look something like that. No, it'll be very different. You need to declare your variables, and you shouldn't be declaring futureInvestmentValue() as a private function. > what should go in for the cout part? Depends what you want to display. If you want to display 1 1093.8 2 1196.41 then probably what you want will be something like: Code:
cout << yearNumber << " " << accumulatedValue << endl; 
Re: Little Help with investment and interest rates
this maybe?
Code:
#include <iostream> 
Re: Little Help with investment and interest rates
No idea. I'm stuck until you answer my questions.

Re: Little Help with investment and interest rates
I was given the number part from someone else, but I think I've got it. Annual result is what i need though adding in amounts from user.

All times are GMT +5.5. The time now is 10:11. 