1 " "LOCK :WAIT 90:CLEAR :USING :DIM ME$(0)*26:ON ERROR GOTO 900
2 CLS :CURSOR 3:PRINT "LOANS AND ANNUITIES":PRINT "  Copr. 1982 Tandy Corp."
10 RESTORE :WAIT 0:FOR I=1TO 6:CLS :READ ME$(0):PRINT ME$(0):FOR J=1TO 75:A$=INKEY$ :IF A$<>""LET J=75
11 NEXT J
12 J=0:FOR K=1TO 5:IF MID$ ("RPLNX",K,1)=A$LET J=K:K=5
13 NEXT K:IF J>0WAIT :I=6:NEXT I:GOTO A$
14 NEXT I:GOTO 10
20 DATA "Select Function:"
21 DATA "Find rate: R"
22 DATA "Find payment: P"
23 DATA "Find loan amount: L"
24 DATA "Find number of payments: N"
25 DATA "Exit program: X"
100 "R"GOSUB "IPV":GOSUB "IPMT":GOSUB "INP":GOSUB "PY"
110 B=A/P:R=1/B-B/(N*N):IF R<=0THEN "R2"
120 "R1"C=1-(1+R)^-N:D=R*B-C:E=D/(C/R-(N*(1+R)^(-N-1)))
130 R=R-E:IF ABS E>=1E-7THEN "R1"
140 I=R*M*100:I=.01*INT (100*I+.5)
150 PRINT "True rate is";I;"%":GOSUB "SUM":GOTO 10
200 "P"GOSUB "IPV":GOSUB "ITR":GOSUB "INP"
210 P=A*R/(1-(1+R)^-N):P=.01*INT (100*P+.5):PRINT "Payment is $";STR$ P:GOSUB "SUM":GOTO 10
300 "L"GOSUB "IPMT":GOSUB "ITR":GOSUB "INP"
310 A=P*(1-(1+R)^-N)/R:A=.01*INT (100*A+.5)
320 PRINT "Loan amount is $";STR$ A:GOSUB "SUM":GOTO 10
400 "N"GOSUB "IPV":GOSUB "ITR":GOSUB "IPMT"
410 IF A*R/P>1THEN "R2"
420 N=-(LOG (1-A*R/P))/(LOG (1+R))
430 PRINT INT N+(N<>INT N);" payments":GOSUB "SUM":GOTO 10
500 "IPV"INPUT "Loan amount? $";A
501 RETURN 
510 "IPMT"INPUT "Payment? $";P
511 RETURN 
520 "INP"INPUT "Number of payments? ";N
521 RETURN 
530 "ITR"INPUT "True interest rate in %? ";I
531 GOSUB "PY":R=I/(M*100):RETURN 
540 "PY"INPUT "Periods per year? ";M
541 RETURN 
600 "SUM"S=.01*INT (100*P*N+.5):T=S-A
610 PRINT "Sum of payments $";STR$ S:PRINT "Sum of interest $";STR$ T:RETURN 
700 "R2"BEEP 3:PRINT "INVALID DATA!":GOTO 10
900 PRINT "*** ERROR";PEEK &789B;" in";STATUS 4;" ***":GOTO 10
999 "X"UNLOCK :END
