Bank Manager - Listing

1REM PROGRAM 'Bank Manager' 2REM from the book '2^5 Mathematical Programs in Basic' 3REM by Jakub Tatarkiewicz & Andrzej Witkowski 4REM English version by Piotr Pagows ki 5MODE3:VDU 19,7,6;0; 9PRINT:PRINT:PRINT:PRINT" H E L L O ! B A N K M A N A G E R":PRINT:PRINT:PRINT 10PRINT"Searched value, code" 20PRINT"Time for saving or paying bac k 1" 30PRINT"Interest rate 2" 40PRINT"Final amount 3" 50PRINT"Investment or loan 4" 60PRINT"Instalment/Dividends rate 5" 70PRINT 80INPUT"Give a problem's code, please ",K 90IF K=1 THEN GOTO 120 100INPUT"Time of operation (years)",N 110IF K=2 THEN GOTO 150 120INPUT"Interest rates(%) per year",I 130I=I/100 140IF K=3 THEN GOTO 180 150INPUT"Final amount-Is it to be paid (Yes=1,No=0)",T 160INPUT"Give amount, please",F 170IF T=1 THEN F=-F 180IF K=4 THEN GOTO 220 190INPUT"Start amount-Is it to be be p aid in(Yes=1,No=0)",T 200INPUT"Give amount, please",P 210IF T=1 THEN P=-P 220INPUT"How many times per year are i nterests added to the savings",D 230R=D 240IF K=5 THEN GOTO 300 250X=0 260INPUT"Instalments/Dividends-Do you pay in(Yes=1,No=0)",T 270INPUT"Give amount, please",S 280IF T=1 THEN S=-S 290IF S=0 THEN GOTO 320 300INPUT"How many instalments per year ",R 310INPUT"Type of payment (back=1, ahea d=0)",X 320IF K=2 THEN GOTO 610 330I1=(1+I/D)^(D/R)-1 340IF K=1 THEN GOTO 410 350IF K=3 THEN GOTO 790 360IF K=4 THEN GOTO 1000 370IF K=5 THEN GOTO 1100 380PRINT"Wrong choice of the code" 390GOTO 10 400REM Time of saving or paying back 410C=S*(1+X*I1)/I1 420N=LOG((C-F)/(C+P))/LOG(1+I1) 430N=INT(N*1E2)*1E-2 440IF F<0 THEN GOTO 470 450PRINT"Final amount to be taken";F 460GOTO 480 470PRINT"Final amount to be paid ";-F 480PRINT"will be reached after ";N;" p eriods" 490PRINT"it means after";INT(10*N/R)/1 0;" years" 500GOTO 10000 600REM Interest rates 610IF S<>0 THEN GOTO 640 620I=((ABS(F/P))^(1/(D*N))-1)*D 630GOTO 750 640I=ABS(S)/(ABS(P)+ABS(F)) 650I=I+(ABS(P)+ABS(F))/ABS(S)/(N^3*R^3 ) 660A=(1+I)^(N*R)-1 670C=S*(1+I*X)/I 680F1=A*(P+C)+P+F 690F2=N*R*(A+1)*(P+C)/(1+I)-A*C/I 700I1=I-F1/F2 710IF (I1-I)/I1<1E-6 THEN GOTO 740 720I=I1 730GOTO 650 740I=((I1+1)^(R/D)-1)*D 750I=INT(I*1E5)*1E-3 760PRINT"Interest rate per year" 770PRINT"is ";I;"%" 780GOTO 10000 790REM Final amount 800C=S*(1+X*I1)/I1 810A=(1+I1)^(N*R)-1 820F=-(P+A*(P+C)) 830F=INT(1E3*F)*1E-3 840PRINT"After ";N;" years the final a mount" 860IF F<0 THEN GOTO 890 870PRINT"to be taken will be ";F 880GOTO 10000 890PRINT"to be paid will be ";-F 900GOTO 10000 1000REM Loan 1010C=S*(1+X*I1)/I1 1020A=(1+I1)^(N*R)-1 1030P=-(F+A*C)/(A+1) 1040P=INT(1E3*P)*1E-3 1050IF P<0 THEN 1080 1060PRINT"The borrowed amount ";P 1070GOTO 10000 1080PRINT"The paid in amount ";-P 1090GOTO 10000 1100REM Instalment rate 1110B=(1+I1*X)/I1 1120A=(1+I1)^(N*R)-1 1130S=-(F+P*(A+1))/(A*B) 1140S=INT(1E3*S)*1E-3 1150IF S<0 THEN GOTO 1180 1160PRINT"The dividends we will get: "; S 1170GOTO 10000 1180PRINT"The instalments we have to pa y ";-S 10000END