# Apple ii CALCULATOR ALGEBRIC AND RPN with Basic and Scientific Functions by MATTEO TREVISAN

No replies
Offline
Joined: Nov 21 2010
Posts: 162

Hello!
After hours of hard thinkering and programming, i have made a fusion between my two Calculator (ALGEBRIC and RPN) in one single program
Here the code:

5 SPEED = 150
6 INVERSE
10 PRINT "APPLE ][ SCIENTIFIC CALCULATOR ALGEBRIC AND RPN 3.0 BY MATTEO TREVISAN"
20 HOME
21 PRINT "DO YOU WANT ALGEBRIC OR RPN CALCULATION MODE: DIGIT COMPLETE WORD": INPUT B\$
22 IF B\$ = "ALGEBRIC" THEN GOTO 31
23 IF B\$ = "RPN" THEN GOTO 26
24 IF B\$ < > "ALGEBRIC" THEN GOTO 10
25 IF B\$ < > "RPN" THEN GOTO 10
26 PRINT "DO YOU WANT BASIC OR SCIENTIFIC CALCULATION MODE: DIGIT COMPLETE WORD": INPUT C\$
27 IF C\$ = "BASIC" THEN GOTO 840
28 IF C\$ = "SCIENTIFIC" THEN GOTO 1470
29 IF C\$ < > "BASIC" THEN GOTO 10
30 IF C\$ < > "SCIENTIFIC" THEN GOTO 10
31 PRINT "DO YOU WANT TO ADD,SUBTRACT,DIVIDE, MULTIPLY, SQUARE ROOT, EXPONENTIATION , PERCENTAGE, TANGENT, LOGARITHM, SINE OR COSINE":INPUT A\$
40 IF A\$ = "ADD" THEN GOTO 120
50 IF A\$ = "SUBTRACT" THEN GOTO 170
60 IF A\$ = "DIVIDE" THEN GOTO 220
70 IF A\$ = "MULTIPLY" THEN GOTO 270
80 IF A\$ = "SQUARE ROOT" THEN GOTO 330
81 IF A\$ = "EXPONENTIATION" THEN GOTO 390
82 IF A\$ = "PERCENTAGE" THEN GOTO 470
83 IF A\$ = "PUDDING" THEN PRINT "DO YOU WANT SOME PUDDING?"
84 IF A\$ = "SINE" THEN GOTO 550
85 IF A\$ = "COSINE" THEN GOTO 620
86 IF A\$ = "TANGENT" THEN GOTO 690
87 IF A\$ = "LOGARITHM" THEN GOTO 760
90 IF A\$ <> "ADD" THEN GOTO 10
91 IF A\$ <> "SUBTRACT" THEN GOTO 10
92 IF A\$ <> "DIVIDE" THEN GOTO 10
93 IF A\$ <> "MULTIPLY" THEN GOTO 10
94 IF A\$ <> "SQUARE ROOT" THEN GOTO 10
95 IF A\$ <> "EXPONENTIATION" THEN GOTO 10
96 IF A\$ <> "PERCENTAGE" THEN GOTO 10
97 IF A\$ <> "SINE" THEN GOTO 10
98 IF A\$ <> "COSINE" THEN GOTO 10
99 IF A\$ <> "TANGENT" THEN GOTO 10
100 IF A\$ <> "LOGARITHM" THEN GOTO 10
120 PRINT "TELL ME THE NUMBER TO ADD"
130 PRINT "NUMBER ONE":INPUT B
140 PRINT "NUMBER TWO":INPUT C
150 D = B+C
160 PRINT "THE ADDITION IS "; D
161 FOR K = 1 TO 5000
162 NEXT K
165 GOTO 10
170 PRINT "TELL ME THE NUMBER TO SUBTRACT"
180 PRINT "NUMBER ONE":INPUT E
190 PRINT "NUMBER TWO":INPUT F
200 G = E-F
210 PRINT "THE SUBTRACTION IS "; G
211 FOR K = 1 TO 5000
212 NEXT K
215 GOTO 10
220 PRINT "TELL ME THE NUMBER TO DIVIDE"
230 PRINT "NUMBER ONE":INPUT H
240 PRINT "NUMBER TWO":INPUT I
241 IF I = 0 THEN GOTO 265
250 L = H/I
260 PRINT "THE DIVISION IS "; L
262 FOR K = 1 TO 5000
263 NEXT K
265 GOTO 10
270 PRINT "TELL ME THE NUMBER TO MULTIPLY"
280 PRINT "NUMBER ONE":INPUT M
290 PRINT "NUMBER TWO":INPUT N
300 O = M*N
310 PRINT "THE MULTIPLY IS "; O
311 FOR K = 1 TO 5000
312 NEXT K
315 GOTO 10
320 REM THIS PART OF THE PROGRAM WAS ADDED BY INSANITOR
330 PRINT "TELL ME THE NUMBER TO SQUARE ROOT"
335 PRINT "NUMBER":INPUT Q
350 PRINT "THE SQUARE ROOT IS ";SQR(Q)
360 FOR K = 1 TO 5000
370 NEXT K
380 GOTO 10
390 PRINT "TELL ME THE NUMBER YOU WANT THE EXPONENTIATION"
400 PRINT "NUMBER ONE":INPUT P
410 PRINT "NUMBER TWO":INPUT Q
420 R = P^Q
430 PRINT "THE EXPONENTIATION IS "; R
440 FOR K = 1 TO 5000
450 NEXT K
460 GOTO 10
470 PRINT "TELL ME THE PERCENTAGE TO CALCULATE"
480 PRINT "NUMBER ONE %":INPUT S
490 PRINT "NUMBER TWO":INPUT T
500 U = (S/100)*T
510 PRINT "THE PERCENTAGE IS "; U
520 FOR K = 1 TO 5000
530 NEXT K
540 GOTO 10
550 PRINT "TELL ME THE NUMBER TO SINE"
560 PRINT "INSERT NUMBER":INPUT V
570 Z = SIN(V)
580 PRINT "SINE IS "; Z
590 FOR K = 1 TO 5000
600 NEXT K
610 GOTO 10
620 PRINT "TELL ME THE NUMBER TO COSINE"
630 PRINT "INSERT NUMBER":INPUT Y
640 W = COS(Y)
650 PRINT "COSINE IS "; W
660 FOR K = 1 TO 5000
670 NEXT K
680 GOTO 10
690 PRINT "TELL ME THE NUMBER TO TANGENT"
700 PRINT "INSERT NUMBER":INPUT SA
710 SB = TAN(SA)
720 PRINT "TAN IS "; SB
730 FOR K = 1 TO 5000
740 NEXT K
750 GOTO 10
760 PRINT "TELL ME THE NUMBER TO LOGARITHM"
770 PRINT "INSERT NUMBER":INPUT SC
780 SD = LOG(SC)
790 PRINT "LOGARITHM IS "; SD
800 FOR K = 1 TO 5000
810 NEXT K
820 GOTO 10
840 PRINT "NUMBER ONE":INPUT SA
850 PRINT"NUMBER TWO":INPUT SB
860 PRINT "PLEASE DIGIT ONE OF THE FOLLOWING FUNCTIONS ADD,SUBTRACT,DIVIDE, MULTIPLY, PERCENTAGE, EXPONENTIATION": INPUT E\$
870 IF E\$ = "ADD" THEN GOTO 910
880 IF E\$ = "SUBTRACT" THEN GOTO 970
890 IF E\$ = "DIVIDE" THEN GOTO 1211
900 IF E\$ = "MULTIPLY" THEN GOTO 1280
901 IF E\$="PERCENTAGE" THEN GOTO 1330
902 IF E\$="EXPONENTIATION" THEN GOTO 1380
903 IF E\$ <> "ADD" THEN GOTO 10
904 IF E\$ <> "SUBTRACT" THEN GOTO 10
905 IF E\$ <> "DIVIDE" THEN GOTO 10
906 IF E\$ <> "MULTIPLY" THEN GOTO 10
907 IF E\$ <> "PERCENTAGE" THEN GOTO 10
908 IF E\$ <> "EXPONENTIATION" THEN GOTO 10
910 SC = SA+SB
960 PRINT "THE ADDITION IS "; SC
961 FOR SK = 1 TO 5000
962 NEXT SK
965 GOTO 10
970 SD = SA-SB
980 PRINT "THE SUBTRACTION IS "; SD
990 FOR SK = 1 TO 5000
1000 NEXT SK
1010 GOTO 10
1211 IF SB = 0 THEN GOTO 10
1230 SE = SA/SB
1240 PRINT "THE DIVISION IS "; SE
1250 FOR SK = 1 TO 5000
1260 NEXT SK
1270 GOTO 10
1280 SF = SA*SB
1290 PRINT "THE MULTIPLY IS "; SF
1300 FOR SK = 1 TO 5000
1310 NEXT SK
1320 GOTO 10
1330 SY = (SA/100)*SB
1340 PRINT "THE PERCENTAGE IS "; SY
1350 FOR SK = 1 TO 5000
1360 NEXT SK
1370 GOTO 10
1380 SG = SA^SB
1430 PRINT "THE EXPONENTIATION IS "; SG
1440 FOR SK = 1 TO 5000
1450 NEXT SK
1460 GOTO 10
1470 PRINT "INSERT NUMBER " : INPUT SH
1480 PRINT "PLEASE DIGIT ONE OF THE FOLLOWING FUNCTIONS TANGENT, LOGARITHM, SINE, COSINE OR SQUARE ROOT" : INPUT D\$
1490 IF D\$ = "TANGENT" THEN GOTO 1570
1500 IF D\$ = "LOGARITHM" THEN GOTO 1620
1510 IF D\$ = "SINE" THEN GOTO 1670
1520 IF D\$ = "COSINE" THEN GOTO 1720
1521 IF D\$ = "SQUARE ROOT" THEN GOTO 1770
1530 IF D\$ < > "TANGENT" THEN GOTO 10
1540 IF D\$ < > "LOGARITHM" THEN GOTO 10
1550 IF D\$ < > "SINE" THEN GOTO 10
1560 IF D\$ < > "COSINE" THEN GOTO 10
1561 IF D\$ < > "SQUARE ROOT" THEN GOTO 10
1570 SI = TAN(SH)
1580 PRINT "TAN IS "; SI
1590 FOR SK = 1 TO 5000
1600 NEXT SK
1610 GOTO 10
1620 SL = LOG(SH)
1630 PRINT "LOGARITHM IS "; SL
1640 FOR SK = 1 TO 5000
1650 NEXT SK
1660 GOTO 10
1670 SM = SIN(SH)
1680 PRINT "SINE IS "; SM
1690 FOR SK = 1 TO 5000
1700 NEXT SK
1710 GOTO 10
1720 SN = COS(SH)
1730 PRINT "COSINE IS "; SN
1740 FOR SK = 1 TO 5000
1750 NEXT SK
1760 GOTO 10
1770 SO = SQR(SH)
1780 PRINT "SQUARE ROOT IS "; SO
1790 FOR SK = 1 TO 5000
1800 NEXT SK
1810 GOTO 10
1820 END

YOU CAN DOWNLOAD THE PROGRAM CLICKING HERE .DSK FORMAT!! FOR EMULATORS AND APPLE II

__________________

"gate gate paragate parasangate bodhi svahdl"
"Stay hungry, Stay Foolish!"
"Think Different"