Translate, changes numbers to words (TRANSLAT.BAS)

Translate, changes numbers to words

Description

Translate, changes numbers to words

From the Antic disk of Best of Antic Book — disk B.

The magazine article

From the Antic Software Archive at atarimagazines.com. The program remains the property of its author and publisher.

What is in this file

Atari BASIC program · 2.9 KB

Dialect
Atari BASIC
Lines
50
Variables
B$, N$, EA$, AMOUNT$, N(, SW, ME, LA, N, J1, J2, LEA, J
BASIC listing (50 lines)
100 REM TRANSLATE 5/28/82 BY JERRY WHITE for ANTIC Magazine
110 DIM B$(80),N$(152),EA$(80),AMOUNT$(10),N(27,27)
120 EA$=" ":EA$(80)=" ":EA$(2)=EA$:B$=EA$:GOTO 330
130 EA$=B$:EA$=" ":SW=0:FOR ME=1 TO LA
140 IF AMOUNT$(ME,ME)="." THEN EA$(LEN(EA$)+1)="DOLLARS AND ":? "DOLLARS AND ":GOTO 280
150 IF SW=1 THEN SW=0:GOTO 280
160 IF AMOUNT$(ME,ME)="," THEN SW=2:GOTO 270
170 TRAP 280:SW=0:N=VAL(AMOUNT$(ME,ME)):J1=N(N,1):J2=N(N,2):TRAP 40000
180 IF N=0 THEN SW=2:GOTO 280
190 IF LA=ME OR ME=LA-3 OR ME=LA-5 OR ME=LA-6 OR ME=LA-7 THEN 240
200 IF LA=8 AND ME=1 THEN 240
210 IF AMOUNT$(ME,ME)<>"1" THEN 230
220 SW=1:N=VAL(AMOUNT$(ME,ME+1)):J1=N(N,1):J2=N(N,2):GOTO 240
230 N=N+18:J1=N(N,1):J2=N(N,2)
240 EA$(LEN(EA$)+1)=N$(J1,J2):? N$(J1,J2);
250 IF ME=LA-5 AND N<>0 THEN EA$(LEN(EA$)+1)=" HUNDRED":? " HUNDRED";
260 IF SW<>2 THEN EA$(LEN(EA$)+1)=" ":? "";
270 IF SW=2 THEN EA$(LEN(EA$)+1)="THOUSAND ":SW=0:? "THOUSAND "
280 NEXT ME
290 IF AMOUNT$(LA-1,LA)="00" THEN EA$(LEN(EA$)+1)="NO ":? "NO ";
300 IF AMOUNT$(LA-1,LA)="01" THEN EA$(LEN(EA$)+1)="CENT":? "CENT":GOTO 320
310 EA$(LEN(EA$)+1)="CENTS":? "CENTS"
320 LEA=LEN(EA$):? :? EA$(2,LEA):? #2;EA$(2,LEA):? #2:RETURN
330 N$="ONETWOTHREEFOURFIVESIXSEVENEIGHTNINETENELEVENTWELVETHIRTEENFOURTEENFIFTEENSIXTEENSEVENTEEN"
340 N$(LEN(N$)+1)="EIGHTEENNINETEENTWENTYTHIRTYFORTYFIFTYSIXTYSEVENTYEIGHTYNINETY"
350 DATA 1,3,4,6,7,11,12,15,16,19,20,22,23,27,28,32,33,36,37,39,40,45,46,51,52,59,60,67,68,74,75,81,82,90
360 DATA 91,98,99,106,107,112,113,118,119,123,124,128,129,133,134,140,141,146,147,152
370 GRAPHICS 0:POKE 82,2:POKE 83,39:POKE 710,160:POKE 752,1
380 ? :? "   This program translates numeric"
390 ? :? "dollar and cent amounts into English."
400 ? :? "Input must be numeric so do not enter"
410 ? :? "dollar signs.  Always include decimal"
420 ? :? "point between dollars and cents, and"
430 ? :? "a comma between the thousand and the"
440 ? :? "hundred columns when the amount is"
450 ? :? "greater than 999.99."
460 FOR J=1 TO 27:READ J1,J2:N(J,1)=J1:N(J,2)=J2:NEXT J
470 ? :? "   Make sure your printer is ready,":? :? "then press START."
480 IF PEEK(53279)<>6 THEN 480
490 TRAP 560:CLOSE #2:OPEN #2,8,0,"P:":TRAP 40000:POKE 752,0:? CHR$(125)
500 ? :? "Enter numeric amount or just press":? :? "the RETURN key to quit";
510 INPUT AMOUNT$:LA=LEN(AMOUNT$):IF LA=0 THEN 570
520 TRAP 550:IF LA<4 OR LA>9 OR AMOUNT$(LA-2,LA-2)<>"." THEN 550
524 IF LA<7 THEN 530
525 IF LA>6 AND AMOUNT$(LA-6,LA-6)<>"," THEN ? CHR$(253):? "A , MUST SEPERATE THOUSANDS,HUNDREDS":GOTO 500
530 TRAP 40000:? CHR$(125):? :? "CONVERTING $";AMOUNT$:? :? #2;"$";AMOUNT$
540 GOSUB 130:GOTO 500
550 ? CHR$(253):? ,"INVALID AMOUNT":GOTO 500
560 ? CHR$(253):? "   READY PRINTER THEN PRESS START":GOTO 480
570 GRAPHICS 0:? :? "BASIC":? "IS";:END