Works out the monthly deposit needed to reach a chosen amount at a given yearly interest rate and number of months. It can then take a deposit rounded up to the cent and give the smaller last payment.
RUN it. Answer F to stop or C to enter the rounded deposit. The rate must be more than 0. Four lines were corrected so that they run: a closing quote in 110, a bracket in 115, the quotes inside the question in 150, and a stray period after the quote in 240.
Borrowed from CCAT/S.
Published in LISTing March 1989 (Calculate A Sinking Fund).
Source Code
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"Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.


