Page 1 of 1

Not All Data is printing

Posted: Thu Oct 18, 2012 8:28 pm
by JasonQuinn1992
Hello again guys, so I was working on a program within the syntax error thread... I finally got the program to run but i notice that when i run the program my heading and the first couple lines of my data is missing, can someone help me solve this problem

' Program that lists inventory for your collection of model cars
'
'
'
' Variables Used

' T1$, H1$, H2$, D1$ Print images
' TL$ Print images
' Manufact$ Manufacturer #
' Yr Year Of Car
' Make$ Make of Car
' Model$ Model Of Car
' Desc$ Description of car
' Price Price Of Car
' TotPrice Tot Price Of Cars

' Program Mainline

CLS
GOSUB InitializeVariables
GOSUB PrintHeadings
GOSUB ProcessDetail
GOSUB PrintTotals
END

' Initalize Variables

InitializeVariables:
LET TotPrice = 0
LET T1$ = ""
LET H2$ = " Manufacturer # Yr Make Model Description Price"
LET D1$ = "\ \ ## \ \ \ \ \ \ $ ###.##"
LET TL$ = " TOTAL $ ###.##"
RETURN

'
' Initialize Imagees

InitializeImages:

' T1$ Title Line
' H1$, H2$ Column Headings
' D1$ Deatail (manufacturer #, Yr, Make, description, price)
' TL$ Totals

' PRINT HEADINGS

PrintHeadings:
PRINT T1$; 'Print title line
PRINT
PRINT H1$ 'Print column headings, line 1
PRINT
RETURN


'Process Detail

ProcessDetail:
GOSUB ReadData
DO UNTIL Manufact$ = "END"
GOSUB CalculateTotal
GOSUB PrintDetail
GOSUB PrintTotals
GOSUB ReadData
LOOP

END

CLS

ReadData:
READ Manufact$, Yr%, Make$, Model$, Desc$, Price#
RETURN

PrintDetail:
PRINT USING D1$; Manufact$; Yr%; Make$; Model$; Desc$; Price#
RETURN

MyData:
READ Manufact, Yr, Make, Model, Desc, Price
DATA BMR-R79,49,FIAT,500B,GILLETE RAZOR,7.99
DATA HOTWELS-34,57,CHEVY,NOMAD,4/DR STATION WAGON,12.95
DATA MATCHBX-878,73,FORD,BRONC,3/DR 4X4 RED SPARE WHL,25.99
DATA MATCHBX-72,69,BUIK,CENTY,YELLOW TAXI,1.49
DATA BRM-R88,34,BUGANT,TY575,RACER BLACK ,35.00
DATA MATCHBX-25,80,LINCO,MRKIV,WHITE LIMOUSINE,14.99
DATA LESNEY-Y42,82,CHEVY,MALBU,4/DR GREEN PASSENGER,1.99
DATA HASBRO-119,75,AMC,GRMLN,2/DR SEDAN YELLOW,1.69
DATA TABY-6332,71,TOYOT,CELIC,2/DR SEDAN BLUE,2.99
DATA BMR-SY238,36,ROLRY,SYLVC,4/DR SEDAN BLACK,60.00
DATA "END",0,0,0,0,0,0
' Calculate Total

CalculateTotal:
LET TotPrice# = TotPrice# + Price#
RETURN

' Print Totals

PrintTotals:
PRINT USING TL$; TotPrice#
PRINT
RETURN


Thank you guys!

Posted: Fri Oct 19, 2012 1:45 am
by burger2227
Just do ReadData in the loop not ahead of it and take READ line out of the DATA statement too!

Code: Select all

DO
GOSUB ReadData 
IF Manufact$ = "END" THEN EXIT DO
GOSUB CalculateTotal 
GOSUB PrintDetail 
GOSUB PrintTotals 
LOOP

Posted: Sat Oct 20, 2012 2:12 am
by JasonQuinn1992
Thanks for your reply! I did as you said and still see no difference when i print the data....