Once upon a time a few idle hours I did find. Oh me! Oh my! What to do? Well why don’t I try this copy of IBMCOPY that has been sitting here. Ok, now that I have it fired up, what am I going to try it on. Well, since I can’t use the bulk of the IBM type of software I might try a BASIC program. Out went the word, I need a victim! One of my scouts returned with a program to compute loan interests AND a book on the version of BASIC it was written in.
My first task was to see if I could make it work with the QL. I achieved that goal. But, the program did not seem to have any flash, verve, it was so plain.
With out making too many changes to the basic concept of the program I began to look at things I could try that would make the program easier to run and nicer to look at.
One of the things I learned is that I STILL like SuperBasic. The other lesson I discovered is that even in the IBM world, program writers do not always use good programming techniques.
The program is pretty much straight forward, just follow the prompts, and the directions as they appear on the screen.
I intentionally did not make major changes in the basic structure of the program. The primary goal was making the conversion process work. All facets of the IBM Basic were translatable in this program. Toolkit did make the process easier.
One of the nicer things I was able to achieve was the appearance of a “window” for the directions for the various steps where you enter information in response to the prompts. The math did check out to be a little better then a PC with out a math co-processor.
100 REMark your P. C. Mortgage Aid, using ToolKit 2
110 :
120 WINDOW 488,240,20,0 : OPEN #4,scr_224x94a122x130 : MODE 8
130 CSIZE 3,1 : CLS : AT 2,8 : PRINT "Your Computer"
140 CSIZE 1,0
150 AT 9,9
160 PRINT "Mortgage Aid"
170 PRINT ," QL Version "
180 AT 19,1 : PRINT "Press space bar to continue"
190 IF INKEY$ <> " " : GO TO 190
200 MODE 4
210 DIM loan(500,2)
220 GO SUB 280
230 IF I$=CHR$(27) : STOP
240 IF I$="2" : GO TO 930
250 IF I$="1" : GO TO 500
260 GO TO 220
270 GO SUB 460
280 REMark -MAIN OPTION MENU
290 CLS : PRINT TO 22;" MORTGAGE ANALYSIS "
300 AT 3,8 : PRINT "OPTIONS - "
310 PRINT ,,"1 - Mortgage Payment Comparisons "
320 PRINT ,,"2 - Mortgage Amortization"
330 PRINT ,,"ESC KEY - EXIT"
340 PRINT ,,"OPTION NUMBER (1,2, OR ESC) =====>"
350 CLS #4 : BORDER #4,2,4
360 PRINT #4;" MORTGAGE PAYMENT COMPARISONS"
370 PRINT #4;" - Use This Option To Compare"
380 PRINT #4;" The Monthly Payments Of"
390 PRINT #4;" Mortgages At Various Rates"
400 PRINT #4;" And Principal Amounts."
410 PRINT #4;" MORTGAGE AMORTIZATION"
420 PRINT #4;" - Use This Option To Calculate"
430 PRINT #4;" The Principal And Interest"
440 PRINT #4;" Paid Over Any 12 Month Period."
450 AT 8,51
460 I$=INKEY$
470 IF I$="" : GO TO 460 : ELSE : PRINT I$; : RETurn
480 CLS
490 PF = AF*(RF/(1-(1/((1+RF)^NF)))) : RETurn
500 REMark MORTGAGE COMPARISONS
510 CLS : PRINT " MORTGAGE PAYMENT COMPARISON PROGRAM "
520 CLS #4 : BORDER #4,2,4
530 PRINT #4;" MORTGAGE PAYMENT COMPARISONS"
540 PRINT #4;" - Use This Option To Compare"
550 PRINT #4;" The Monthly Payments Of"
560 PRINT #4;" Mortgages At Various Rates"
570 PRINT #4;" And Principal Amounts."
580 PRINT #4
590 PRINT #4;" NOTE: To Select A Value Or Amount"
600 PRINT #4;" Enter The Appropriate Value"
610 PRINT #4;" And Press The ENTER Key."
620 AT 3,1 : INPUT "ENTER BASE MORTGAGE AMOUNT ===> ";A$
630 A = A$
640 IF A <= 0 : GO TO 600
650 AINC = 2000
660 AT 4,1 : PRINT TO 38
670 AT 5,1 : PRINT "(1 TO 35 PERCENT)";
680 AT 4,1 : INPUT "ENTER BASE INTEREST RATE = ====> ";IR$
690 IR = IR$
700 IF IR>35 OR IR<1 : GO TO 660
710 R = IR/1200 : RINC = 2.5E-3/12
720 AT 5,1 : PRINT TO 38
730 AT 5,1 : INPUT "ENTER NUMBER OF YEARS IN MTG (1 TO 35 YEARS) =>";Y$
740 N = Y$ * 12
750 NF = N
760 IF NF>420 OR NF<1 : GO TO 720
770 CLS
780 PRINT " MONTHLY MORTGAGE PAYMENT COMPARISONS "
790 AT 3,10 : PRINT Y$;"-YEAR MORTGAGE LOAN AMOUNTS";
800 AT 5,6 : PRINT "RATES",,," ";A;".00"
810 FOR I = 0 TO 14
820 AT 6+I,0
830 pu(INT(((R+(I*RINC))*120000)+.5)/100)
840 RF = R+I*RINC : AF=1 : GO SUB 490
850 P = INT(((PF*(A))+5.000001E-3)*100)/100
860 IF P>10000 : AT 22,1 : PRINT "PAYMENTS TOO LARGE TO DISPLAY" : GO TO 900
870 AT 6+I,29 : pu(P)
880 END FOR I
890 PRINT
900 PRINT ,, "PRESS SPACE BAR TO CONTINUE"
910 IF INKEY$ <> " " : GO TO 910
920 GO TO 220
930 REMark - mortgage amortization
940 CLS : PRINT,,, " MORTGAGE AMORTIZATION PROGRAM "
950 CLS #4 : BORDER #4,2,4
960 PRINT #4;" MORTGAGE AMORTIZATION"
970 PRINT #4;" - Use This Option To Calculate"
980 PRINT #4;" The Principal And Interest"
990 PRINT #4;" Paid Over Any 12 Month Period."
1000 PRINT #4
1010 PRINT #4;" NOTE: To Select A Value Or Amount"
1020 PRINT #4;" Enter The Appropriate Value"
1030 PRINT #4;" And Press The ENTER Key."
1040 AT 2,0
1050 INPUT "ENTER MORTGAGE AMOUNT ====================> ";A$
1060 AF = A$
1070 IF AF <= 0 : GO TO 1050
1080 INPUT "ENTER INTEREST RATE (1 TO 35 PERCENT) =====> ";IR$
1090 IR = IR$
1100 IF IR<1 OR IR>35 : GO TO 1080
1110 RF = IR/1200
1120 INPUT "ENTER NUMBER OF YEARS (1 TO 35 YEARS) =====> ";Y$
1130 NF = Y$ * 12
1140 IF NF<1 OR NF>420 : GO TO 1120
1150 GO SUB 490
1160 PF = INT((PF+5.000001E-3)*100)/100
1170 PRINT "MONTHLY PAYMENTS ARE =====================> ";PF
1180 PRINT "CALCULATING AMORTIZATION"
1190 loan(0,1) = AF
1200 FOR I = 1 TO NF
1210 loan(I,2) = INT((loan(I-1,1)*RF+5.000001E-3)*100)/100
1220 loan(I,1) = loan(I-1,1)-PF+loan(I,2)
1230 END FOR I
1240 FOR I = 6 TO 23 : AT I,0 : PRINT TO 77
1250 AT 7,9
1260 PRINT "- 1 TO ";NF; " - 0 TO END AMORTIZATION"
1270 AT 6,1 : INPUT "ENTER BEGINNING PAYMENT NUMBER OF 12 MONTH PERIOD ======> ";PERIOD$
1280 PD= PERIOD$
1290 IF PD <> 0 : GO TO 1320
1300 IF PERIOD$ <> "0" : GO TO 1270
1310 GO TO 220
1320 IF PD<0 OR PD>NF : GO TO 1270
1330 AT 6,1 : PRINT TO 70
1340 AT 7,1 : PRINT TO 70
1350 AT 7,1
1360 PRINT "PYMNT PRINCIPAL INTEREST BALANCE"
1370 TINT = 0
1380 FOR I = PD TO PD+11
1390 IF I> NF : GO TO 1420
1400 TINT = TINT + loan(I,2)
1410 PRINT_USING "### ";I; : pu(PF-loan(I,2)) : pu(loan(I,2)) : pu(loan(I,1))
1420 PRINT : END FOR I
1430 PRINT "INTEREST FOR 12 PERIODS ="; : pu(TINT) : PRINT
1440 PRINT ,,,"PRESS SPACE BAR TO CONTINUE";
1450 AT 0,0
1460 IF INKEY$ <> " " : GO TO 1460
1470 GO TO 1240
1480 :
1490 DEFine PROCedure pu(x)
1500 PRINT_USING " ######.##";x;
1510 END DEFine
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.