Will the following function for calculating Future value based on present value, interest rate and time period work in iphone?
-(float) calcFV: float pv: float interest_rate: float time
{
float fv, pv, interest_rate, t;
//pv = 200000.0; // present value
//i = 0.012; // interest rate (1.2%)
//t = 5.0; // time period
fv = pv * pow (1.0 + interest_rate, time);
return fv;
}
Yes, and no!
Despite the fact that your formula is correct, you are declaring pv and interest_rate, as well as passing them in as parameters.
Remove the declarations:
Incidentally, your .h file should now have this:
Considering the equation is
current * (1.0+interest)^time
, yes it will.