Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I wanted a function which accepts present value, number of years and compound interest rate. It should return me the Future value based on these parameters.

You can see the exact thing that I am looking for at http://en.wikipedia.org/wiki/Future_value (under To determine future value using compound interest)

Does Objective-C has any inbuilt function to do that. If no, could you please provide me any references to write that function.

Thanks in advance for all your help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
236 views
Welcome To Ask or Share your Answers For Others

1 Answer

No, neither Objective-C nor Apple's frameworks include specific financial functions.

It's trivial to implement. The Wikipedia article you link to includes the formula. You might also want to consider something like QuantLib if you ever get onto more sophisticated calculations.

The formula -- copied from the Wikipedia article you linked to -- is:

FV = PV . (1 + i) ^ t

This can be converted into Objective-C mainly by typing:

  float fv, pv, i, t;

  pv = 200000.0; // present value
  i  = 0.012;    // interest rate (1.2%)
  t  = 5.0;      // time period

  fv = pv * pow (1.0 + i, t);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...