10 REM BASIC LOAN ANALYSIS
12 WIDTH 80:DOLL$="$$######,.##":NUMM$="######,.##":PERR$="######,.##_ _%"
20 ON ERROR GOTO 1400
25 GOTO 100 'start main program
50 REM subroutine to strip out any comma's and evaluate a "K" entry
51 D2$=""
52 FOR C=1 TO LEN(D$)
53 IF MID$(D$,C,1)="," THEN 56 ELSE D2$=D2$+MID$(D$,C,1)
56 NEXT
57 D$=D2$ : IF RIGHT$(D$,1)="K" OR RIGHT$(D$,1)="k" THEN D=VAL(LEFT$(D$,LEN(D$) -1))*1000 ELSE D=VAL(D$)
59 RETURN ' end of subroutine
100 REM start main program
101 CLS:KEY OFF
105 COLOR 0,7:PRINT SPC(79):LOCATE ,30:PRINT "LOAN ANALYSIS":COLOR 7,0:PRINT
110 PRINT "This Program calculates the missing factor of any fully amortized loan" : PRINT "given the other three. It also provides details on the full cost of the loan"
115 PRINT "and the interest paid over any specified period."
130 LOCATE 7,1:PRINT "Factors of the Loan : Any one of these four factors may be unknown.":PRINT "Principal, Monthly Payment, Number of Payments, & Annual Interest Rate"
140 PRINT "--------- --------------- ------------------ --------------------";
145 LOCATE 25,8:PRINT "For the ONE unknown item, enter nothing, just press return";
150 LOCATE 11,1:LINE INPUT"What is the Principal Amount of the Loan ? ";V$: PRINT
155 D$=V$ : GOSUB 50 : V$=D$ : V=D 'strip out comma's & evaluate "K"
170 LINE INPUT"What is the Amount of the Monthly Payment ? ";M$: PRINT
175 D$=M$ : GOSUB 50 : M$=D$ : M=D 'strip out comma's & evaluate "K"
180 LINE INPUT"How many Monthly Payments have to be made ? ";N$: PRINT
185 D$=N$ : GOSUB 50 : N$=D$ : N=D 'strip out comma's & evaluate "K"
190 LINE INPUT"What's the Annual Percentage Interest Rate ? ";I$: PRINT
195 D$=I$ : GOSUB 50 : I$=D$ : I=D/1200 'strip out comma's & evaluate "K"
199 OL=CSRLIN : LOCATE 25,8:PRINT SPC(71); : LOCATE OL,1
200 REM
201 IF V$="" AND (M$="" OR N$="" OR I$="") THEN PRINT :PRINT "MORE TAHN ONE UNKNOWN .... SORRY .... STOP PROGRAM":END
203 IF M$="" AND (N$="" OR I$="") THEN PRINT :PRINT "MORE THAN ONE UNKNOWN .... SORRY .... STOP PROGRAM":END
205 IF N$="" AND I$="" THEN PRINT :PRINT "MORE TAHN ONE UNKNOWN .... SORRY .... STOP PROGRAM":END
250 REM
251 IF M$="" THEN 500
252 IF N$="" THEN 600
253 IF M*N5 AND ERR<>6 THEN 1450
1410 SOUND 45,12:PRINT "SORRY ... But the loan parameters you entered are beyond the computational":PRINT" range of this program. ":PRINT
1412 LINE INPUT;"Would you like to cycle thru another problem (y or n) ? " ;YORN$
1414 IF LEFT$(YORN$,1)="y" OR YORN$="Y" THEN RUN ELSE END
1450 ON ERROR GOTO 0 : PRINT "Program ERROR... STOP PROGRAM":STOP