Simple savings account

Alex Tweedly alex at tweedly.net
Mon Mar 14 20:46:20 EST 2005


Paul Salyers wrote:

> A = P(1+ r/m)^mt
> where P is the principle (money in the account to start)
> where r is the intest rate
> where m is the compound times / year
> where t is the number of years to calculate for
> m X t
> and ^ is the power of, so x to the power of mt
>
> Dear Rev Proframmers
>
> I need a simple stack to do this.
>
> I want a text field to enter amount of savings, interest, and it will 
> put out in the label Princ, Interest, & total.
>
> I was told the above formulas is needed but math is not my thing.

I used an existing stack for testing, so  I used items of a field for 
input rather than separate fields.  But allowing for that, it should be 
clear

>   put item 1 of tVar into P
>   put item 2 of tVar into r
>   put item 3 of tVar into m
>   put item 4 of tVar into t
>   put  P * ( (1+r/m) ^ (m*t)) into field "lockedField"

(Remember that for a 4% interest rate, the value you should use here is 
"0.04", not "4".
Took me more tries than I'd like to admit to realize that myself :-)

-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.2 - Release Date: 11/03/2005



More information about the use-livecode mailing list