Micro­power

  

Volume 2 · Number 2 · April 1982

Page 23 of 37

equal to zero to signify the end of the prices for any one program. The routine to enter the prices would skip an element, and the routine to calculate and print the royalties would search for those elements equal to zero, and then move onto the next program. The calculation is then [2(arr ays) x say 75(programs)] + 75(vacant elements) = 225. Multiplying by the 6 bytes per element then gives 1350 bytes. Phew!!

On reflection, this method might also be adopted in handling the program name information. But since the program was written first and it works, we’ll save that up our sleeves, in case we need the space in some future enhancement. We do not of course have to write one large program containing all the options. The tasks to be done can conveniently be split into ‘file maintainence’ i.e. create, amend or delete the standing information, and the ‘operating’ program to enter the prices and numbers sold and print the letters and summary. However, since space did not prove a problem, the program has been left as one complete entity. The version which now follows has been more or less de-bugged, although some improvements, for example, in the print layout, remain to be made. In the next issue I will cover some sections of the program in greater detail, and discuss the operation of the Basic File Handler.

.     .     .     .     .     .     .     .     .     .     .     .     .     .     .     .     .     .

5 DOKE4271,-20482:DOKE4100,-14336:TC$="RESET":TR=USR(0)
10 CLEAR10000:DIMN$(30),A$(30),B$(30),C$(30)
15 DIMD$(30),E$(30),P$(30,20),K(100),L(100)
50 CLS:PRINTAB(17);"ROYALTIES PROGRAM"
55 SCREEN8,3:PRINT"Options:
60 SCREEN5,5:PRINT"1)     New Authors
65 SCREEN5,6:PRINT"2)     New Programs
70 SCREEN5,7:PRINT"3)     Amend/Delete Authors/Programs
80 SCREEN5,8:PRINT"4)     Quarterly Sales/Prices
85 SCREEN5,9:PRINT"5)     Print Authors' Letters
90 SCREEN5,10:PRINT"6)     Print Summary
93 SCREEN5,11:PRINT"7)     Read Program File
96 SCREEN5,12:PRINT"8)     Write Program File
100 PRINT:SCREEN5,14:INPUTC
110 ONCGOTO200,400,600,1000,1200,1400,1600,1800
120 IFC<1ORC>8THEN50
200 FORI=1TO30
205 IFN$(I)=""THENZ=I:I=30:GOTO240
210 NEXT
220 PRINT"No Space for New Author !"
230 FORA=1TO3000:NEXT:GOTO50
240 CLS:I=Z:INPUT"Author's Name";N$(I)
245 IFLEN(N$(I))=<13THEN250
247 PRINT:PRINT"Max. 13 chrs.":FORC=1TO3000:NEXT:GOTO240
250 INPUT"Correct";L$
255 IFL$<>"Y"THEN240
260 INPUT"ADDR 1";A$(I)

Page 23 of 37