Need Help Running QBASIC Program - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Need Help Running QBASIC Program

whoshighpitchwhoshighpitch Posts: 1Member
Hello I hope someone can look at my work and guide me to what I've done wrong
I'm new to QBASIC and was given this program to run but I have completed it
without any errors but I cant get the data to print or get the totals so I
I"m assuming somewhere my logic is wrong. Here is my program:

'****************************************************************************
'* Program showing an inventory list *
'* of a collection of model cars *
'****************************************************************************

' Variables Used:
' T1$, H1$, H2$, Print images
' D1$, TL$ Print images
' NAM$ Vehicle manufacturer
' Year Year vehicle was made
' Make Vehicle make
' Model Vehicle model
' Description$ Vehicle description
' Price Vehicle price
' PriceTot Total vehicle price

'****************************************************************************
'* Program Mainline *
'****************************************************************************

CLS
GOSUB InitializeVariables
GOSUB PrintHeadings
GOSUB PrintDetails
GOSUB PrintTotals
END

'****************************************************************************
'* Initialize Variables *
'****************************************************************************

InitializeVariables:
LET T1$ = " Model Car Inventory List"
LET H1$ = " Vehicle Vehicle "
LET H2$ = "Manufacturer Year Make Model Description Price "
LET D1$ = " ## \ \ ###.##"
LET TL$ = " Totals ###.##"
RETURN

'****************************************************************************
'* Print Headings *
'****************************************************************************

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

'****************************************************************************
'* Process Details *
'****************************************************************************

ProcessDetails:
GOSUB ReadData 'Prime the data read
DO UNTIL NAM$ = "END" 'Loop unitl data done
GOSUB CalculateAnswer
GOSUB PrintDetails
GOSUB ReadData
LOOP
RETURN

'****************************************************************************
' Read Data *
'****************************************************************************

ReadData:
READ Manufacturer$, Yr, Make$, Model$, Description$, Price
DATA "BMR-R79",49,"FIAT","500B","GILLETTE RAZOR",7.99
DATA "HOTWELS-34",57,"CHEVY","NOMAD","4/DR STATION WAGON",12.95
DATA "MATCHBX-878",73,"FORD","BRONCO","3/DR 4X4 RED SPARE WHL",25.99
DATA "MATCHBX-72",69,"BUICK","CENTY","YELLOW TAXI",1.49
DATA "BRM-R88",34,"BUGAT","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,SILVER-GRAY",60.00,,0
DATA "END",0,,,,0
DATA
RETURN

'****************************************************************************
'* Calculate Answer *
'****************************************************************************

CalculateAnswer:
LET Price = PriceTot + Price
RETURN

'****************************************************************************
'* Print Details *
'****************************************************************************

PrintDetails:
PRINT USING D1$; Manufacturer$, Yr, Make$, Model$, Description$, Price 'Print Details
RETURN

'****************************************************************************
'* Print Totals *
'****************************************************************************

PrintTotals:
PRINT
PRINT USING TL$; PriceTot
RETURN

'****************************************************************************
'* End Of Program *
'****************************************************************************







Sign In or Register to comment.