10 REM Expert System Demo H. Bungay Oct 88 15 KEY OFF 16 WIDTH 80 20 DIM B$(400),W(400),D(400) 30 CLS 40 PRINT" Expert System to Decide Who Pays" 50 PRINT 60 PRINT"The program reads its DATA commands to generate this library:" 70 PRINT 80 PRINT" Name Weeks Since Payer Balance" 90 PRINT 100 W(0)=0 110 X=0 120 Y=0 130 T=0 140 FL=1 160 X=X+1 170 READ B$(X),W(X),D(X) 180 IF B$(X)<> "0" THEN PRINT B$(X),W(X),D(X) 190 IF B$(X)<>"0" THEN GOTO 160 200 INPUT"How many eligible persons at the table ";N 210 FOR K= 1 TO N 220 PRINT"First initial and last name" 230 INPUT A$ 240 FOR J= 1 TO X-1 250 IF A$=B$(J) THEN GOSUB 380 260 NEXT J 270 IF FL=1 THEN PRINT A$;" can't pay. It is the first time" 280 FL=1 290 NEXT K 300 PRINT 310 PRINT"The person who has gone longest pays," 320 PRINT"unless there is a large positive balance." 330 PRINT 340 PRINT"In this case, the payer is ";B$(Y); 350 IF Y = 0 THEN PRINT " FLIP for it." 360 STOP 380 FL=0 390 PRINT" ",W(J),D(J) 400 IF W(J)> W(Y) AND D(J) < 5 THEN Y=J 410 RETURN 430 DATA Y. Urstruly,8,-44.44,J. Jones,5, 47.95,S. Spade,3,66.66,C. Gable,11,-2.95, P. Lomoco,1,99.50,J. Tightwad ,48,-112.24 440 DATA E. Fhutton,1,19.32,P. Ricketts,202,-8.95, U. Heep,63,2.10,C. Dickens,404,-43.21 450 DATA 0,0,0,0,0