Sinking funds, an amount established or accumulated for a specific purpose, may be a part of a savings account or an investment plan. Consider calculating a part of monthly savings/investment to determine when a specific amount of accumulated interest can be withdrawn to meet a specific need at a specific time. How much must be dedicated to the account to generate the interest required?
This basic equation is the one to use:
S=A(r)/((1+r)^n-)
where S is the amount of monthly payment into the account
A=amount accumulated (your need)
r=interest in %/(12*100)
n=number of periods as months
This equation is reworked to fit the program needs:
100 INPUT "How much do you need to accumulate? $";AMT
110 INPUT "What is the annual interest rate in %";R;" of the investment or savings account?"
115 LET r=(R/(12*100))
120 INPUT "How many months for the investment to run to meet your need? ";n
130 LET S=AMT*(r/((1+r)^n-1))
140 PRINT "You will need to deposit $";S;" monthly for ";n;" months to produce $";AMT
150 INPUT "If the amount does accumulate to exactly cents then ENTER ""F"". If not then ENTER ""C""";x$
160 IF x$="F" THEN STOP: IF x$="C" THEN GOTO 170
170 INPUT "If your deposits are not exactly the amount to the last cent, use the next higher cent and INPUT the new amount $";t
200 REM change equation to
205 REM A=t*(((1+r)^n)/r)
210 REM recalculate the last payment
220 LET A=t*(((1+r)^(n-1)-1)/r)
225 REM last payment LP=Amount AMT-(A*(1+r))
230 LET LP=AMT-(A*(1+r))
240 PRINT "You will be making payments of $";t;" for ";(n-1);" months, and a last payment of $";LP;" to produce $";AMT;" in interest"
Transcription note: Four lines are corrected so that the program runs. The printing lacks the closing quote in line 110 and the closing bracket in 115, does not double the quotes inside the string in 150, and has a stray period after the last quote in 240.
Borrowed from CCAT/S
Media
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.