Compucolor.org – Virtual Media

Listing of file='CAPT.BAS;01' on disk='vmedia/equity-sector.ccvf'

100 REM  ** CAPITALIZATION - JAN 2,1979 - JESSEN **
110 CLEAR 200
120 PLOT 6,34,12,14,27,24,29
130 E1$= "ENTRY NOT RECOGNIZED"
140 E2$= "TO MANY UNKNOWNS, PROBLEM UNSOLVABLE"
150 DIM  D(3,9),D$(3,9),G(3,9,3)
160 PLOT  3,5,0,6,24
170 PRINT "PERIODIC CHARGES AND CAPITALIZED COST OF AN ASSET"
180 PLOT  6,34,15,3,32,3
190 PRINT  "ASSET A    ASSET B    ASSET C"
200 PRINT :PLOT  6,39
210 PRINT  " 1. INITIAL VALUE OF ASSET"
220 PRINT
230 PRINT  " 2. VALUE OF ASSET AT END"
240 PRINT
250 PRINT  " 3. NUMBER OF PERIODS"
260 PRINT
270 PRINT  " 4. INTEREST RATE PER PERIOD"
280 PRINT
290 PRINT  " 5. MAINTENANCE COST/PERIOD"
300 PRINT
310 PRINT
320 PRINT
330 PRINT  " 6. PERIODIC CHARGES"
340 PRINT
350 PRINT  " 7. PRODUCTIONS UNITS/PERIOD"
360 PRINT
370 PRINT  " 8. PERIODIC CHARGE/UNIT"
380 PRINT
390 PRINT
400 PRINT
410 PRINT  " 9. CAPITALIZED COST"
420 PRINT  :PLOT  6,34
430 FOR  J= 1 TO  9
440 G(1,J,1)= 11: G(1,J,2)= 29:G(1,J,3)= J* 2+ 3
450 G(2,J,1)= 25: G(2,J,2)= 41:G(2,J,3)= J* 2+ 3
460 G(3,J,1)= 47: G(3,J,2)= 53:G(3,J,3)= J* 2+ 3
470 NEXT  J
480 FOR  J= 6 TO  8
490 G(1,J,3)= J* 2+ 5:G(2,J,3)= J* 2+ 5:G(3,J,3)= J* 2+ 5
500 NEXT  J
510 G(1,9,3)= 25:G(2,9,3)= 25:G(3,9,3)= 25
520 GOTO  570
530 REM

    ** COMMAND INPUT **

540 PLOT 3,20,31,11,3,20,31
550 PRINT  E$
560 FOR  I= 1 TO  700: NEXT  I
570 PLOT 6,35,3,20,31,11,3,20,31
580 INPUT  "ENTER ASSET AND LINE NUMBER ";I$
590 PLOT 6,34
600 IF I$= "INS"THEN 110
610 IF LEFT$ (I$,2)= "CA"THEN 860
620 IF  I$= "END" THEN  LOAD "MENU":RUN
630 IF  I$= "ALL" THEN  AB= 1:AE= 3:LB= 1:LE= 9:GOTO  730
640 L$= LEFT$ (I$,1)
650 IF  L$= "A" THEN  AB= 1:AE= 1: GOTO  690
660 IF  L$= "B" THEN  AB= 2:AE= 2: GOTO  690
670 IF  L$= "C" THEN  AB= 3:AE= 3: GOTO  690
680 E$= E1$: GOTO  530
690 IF  LEN (I$)= 1 THEN  LB= 1:LE= 9: GOTO  730
700 L= VAL (RIGHT$ (I$,1))
710 IF  L< 1 OR  L> 9 THEN  E$= E1$:GOTO  530
720 LB= L:LE= L
730 FOR  I= AB TO  AE
740 FOR  J= LB TO  LE
750 PLOT  6,G(I,J,1),3,G(I,J,2)+ 1,G(I,J,3)
760 INPUT  "";V$
770 IF  V$= "" THEN  830
780 IF  V$= "0" THEN  830
790 IF  V$= "X" THEN  D$(I,J)= "X":D(I,J)= 0:GOTO  820
800 V= VAL (V$)
810 D(I,J)= V: D$(I,J)= " "
820 GOSUB  2080
830 NEXT  J
840 NEXT  I
850 GOTO 570
860 PLOT  6,103,3,20,31,11,3,20,31:PRINT  "CALCULATING";
870 REM

     ** IS SOLUTION POSSIBLE ? **

880 E$= ""
890 FOR  I= AB TO  AE
900 IF  I= 1 THEN  E3$= " A"
910 IF  I= 2 THEN  E3$= " B"
920 IF  I= 3 THEN  E3$= " C"
930 A= D(I,1):S= D(I,2):N= D(I,3):R= D(I,4)/ 100:M= D(I,5)
940 H= D(I,6):U= D(I,7):P= D(I,8):C= D(I,9)
950 REM
     ** FIND H **

960 IF  D$(I,6)< > "X" THEN  1170
970 IF  D$(I,1)= "X" THEN  1050
980 IF  D$(I,2)= "X" THEN  1050
990 IF  D$(I,3)= "X" THEN  1050
1000 IF  D$(I,4)= "X" THEN  1050
1010 IF  D$(I,5)= "X" THEN  1050
1020 GOSUB  2310
1030 GOTO  1170
1040 REM

1050 IF  D$(I,4)= "X"THEN  1100
1060 IF  D$(I,9)= "X"THEN  1100
1070 H= C* R
1080 GOTO  1170
1090 REM

1100 IF  D$(I,7)= "X" THEN  1150
1110 IF  D$(I,8)= "X" THEN  1150
1120 H= U* P
1130 GOTO  1170
1140 REM

1150 E$= E2$: GOTO  530
1160 REM
** H IS KNOWN - FIND R **

1170 D$(I,6)= " "
1180 IF  D$(I,4)< > "X" THEN  1380
1190 IF  D$(I,1)= "X" THEN  1320
1200 IF  D$(I,2)= "X" THEN  1320
1210 IF  D$(I,3)= "X" THEN  1320
1220 IF  D$(I,5)= "X" THEN  1320
1230 REM
** SOLVE FOR R **

1240 B= 0:E= 1:R= .5:H1= H:IT= 0
1250 GOSUB  2310
1260 IF  H= H1 THEN  1380
1270 IF  H< H1 THEN  B= R
1280 IF  H> H1 THEN  E= R
1290 R= (B+ E)/ 2
1300 GOTO  1250
1310 REM

1320 IF  D$(I,9)= "X" THEN  1360
1330 R= H/ C
1340 GOTO  1380
1350 REM

1360 E$= E2$+ E3$: GOTO  1990
1370 REM
     ** R IS KNOWN - FIND P **

1380 D$(I,4)= " "
1390 IF  D$(I,7)= "X" THEN  1450
1400 IF  U= 0 THEN  U= 1
1410 P= H/ U
1420 D$(I,8)= " "
1430 GOTO  1530
1440 * *  FIND U * *
1450 IF  D$(I,8)= "X" THEN  1510
1460 IF  P= 0 THEN  U= 0: GOTO  1480
1470 U= H/ P
1480 D$(I,7)= " "
1490 GOTO  1530
1500 REM

1510 E$= E1$: GOTO  530
1520 E$= E2$+ E3$: GOTO  1990
1530 IF  R= 0 THEN  C= 0: GOTO  1550
1540 C= H/ R
1550 D$(I,9)= " "
1560 REM
     ** ANY THER UNKNOWNS **
1570 X= 0
1580 FOR  J= 1 TO  5: IF  D$(I,J)= "X" THEN  X= X+ 1:K= J
1590 NEXT  J
1600 IF  X= 0 THEN  1990
1610 IF  X> 1 THEN  E$= E1$+ E3$: GOTO  1990
1620 IT= 0
1630 ON  K GOTO  1650,1730,1810,1990,1900
1640 REM

     ** SOLVE FOR UNKNOWNS **

1650 REM

     ** FIND A **

1660 H1= H:B= 0:E= 99999999:A= 1000000
1670 GOSUB  2310
1680 IF  H= H1 THEN  D$(I,1)= " ": GOTO  1990
1690 IF  H< H1 THEN  B= A
1700 IF  H> H1 THEN  E= A
1710 A= (B+ E)/ 2
1720 GOTO  1670
1730 REM

     ** FIND S **

1740 H1= H:B= 0:E= 99999999:S= 1000000
1750 GOSUB  2310
1760 IF  H= H1 THEN  D$(I,2)= " ": GOTO  1990
1770 IF  H< H1 THEN  E= S
1780 IF  H> H1 THEN  B= S
1790 S= (B+ E)/ 2
1800 GOTO  1750
1810 REM

     ** FIND N **

1820 H1= H:B= 0:E= 100:N= 50
1830 GOSUB  2310
1840 IF  H= H1 THEN  D$(I,3)= " ": GOTO  1990
1850 IF  H< H1 THEN  E= N
1860 IF  H> H1 THEN  B= N
1870 N= (B+ E)/ 2
1880 IF  N> 99 THEN  E$= "TO LARGE TO SOLVE":GOTO  1990
1890 GOTO  1830
1900 REM

     ** FIND M **

1910 H1= H:B= 0:E= 999999999:M= 1000000
1920 GOSUB  2310
1930 IF  H= H1 THEN  D$(I,5)= " ": GOTO  1990
1940 IF  H< H1 THEN  B= M
1950 IF  H> H1 THEN  E= M
1960 M= (B+ E)/ 2
1970 GOTO  1920
1980 GOTO  1990
1990 REM

     ** PRINT RESULTS **

2000 D(I,1)= A:D(I,2)= S:D(I,3)= N:D(I,4)= R* 100:D(I,5)= M
2010 D(I,6)= H:D(I,7)= U:D(I,8)= P:D(I,9)= C
2020 FOR  J= 1 TO  9
2030 V= D(I,J): GOSUB  2080
2040 NEXT  J
2050 NEXT  I
2060 IF  E$< > "" THEN  530
2070 GOTO  570
2080 REM

     ** PRINT VALUES **

2090 PLOT  6,G(I,J,1),3,G(I,J,2),G(I,J,3)
2100 IF  D$(I,J)< > "X" THEN  2130
2110 PRINT  " X ";:PLOT  6,34:PRINT  "        ";
2120 RETURN
2130 IF  J< > 3 AND  J< > 7 THEN  2170
2140 PRINT  V;" ";
2150 PLOT  6,34:PRINT  SPC( 9- LEN (STR$ (V)))
2160 RETURN
2170 IF  J< > 4 THEN  2230
2180 IF  V= 0 THEN  V= .01:GOTO  2200
2190 V= INT (V* 100)/ 100+ .004
2200 V$= STR$ (V):L= LEN (V$):PRINT  LEFT$ (V$,L- 1)+ "% ";
2210 PLOT  6,34:PRINT  SPC( 10- L)
2220 RETURN
2230 IF  V> - .005 AND V< .005 THEN  V= 0
2240 D1= INT (ABS (V)): IF  V< 0 THEN  D1= - D1
2250 E1= INT ((1.005+ ABS (V)- ABS (D1))* 100)
2260 V$= "$": IF  D1< 0 THEN  V$= "-$"
2270 V$= V$+ RIGHT$ (STR$ (D1),LEN (STR$ (D1))- 1)
2280 PRINT  RIGHT$ ("     "+ V$+ "."+ RIGHT$ (STR$ (E1),2)+ " ",11);
2290 PRINT
2300 RETURN
2310 REM

** SOLVE EQUATION **

2320 IF  R= 0 THEN  SN= 0: GOTO  2360
2330 SN= ((1+ R)^ N- 1)/ R
2340 IF  SN= 0 THEN  2360
2350 SN= (A- S)/ SN
2360 H= (A* R)+ SN+ M
2370 IT= IT+ 1: IF  IT> 99 THEN  H1= H
2380 RETURN