Receiving Syntax error on homework (Code included)

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
QBasicin2019
Newbie
Posts: 1
Joined: Fri Mar 22, 2019 8:42 pm

Receiving Syntax error on homework (Code included)

Post by QBasicin2019 » Fri Mar 22, 2019 9:28 pm

Hey, I have a QB project due this sunday and I'm receiving a syntax error. I have a hunch that it's the numeric constants of (-,/) , but the given data for the project incorporates them. I would truly appreciate some wisdom on the subject.

This is the project question:

Write a program to create an inventory list for your collection of model cars using the top-down approach in planning, coding, and testing the program. Code the main module and the detail module, and create sub submodules for the initialization, title, headings, read, calculations, output, and totals.

The only total required is the total price of the collection.

Code: Select all

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

GOSUB InitializeVariables

GOSUB PrintHeadings

GOSUB ProcessDetail

GOSUB PrintTotals

END


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

InitializeVariables:

T1$ = "          Model Car Collection"

H1$ = "  Manufacturer #    Yr   Make    Model   Description                   Price  "

D1$ = "\            ##\,     ##,  \     \, \     \, \                            \, ##.## " 

TL$ = "    Collection Total Value                                           ####.##"


RETURN



' ***** Print Headings ***

PrintHeadings:

PRINT

PRINT T1$

PRINT

PRINT H1$

PRINT

PRINT

RETURN


' ***** Process Detail ***
ProcessDetail: 
GOSUB ReadData
DO UNTIL Nam$ = "END"
GOSUB CalculateAnswer
    GOSUB PrintDetail
    GOSUB ReadData
LOOP
Return
'


' ***** Read Input Data ****
ReadData:
READ Nam$, 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, BRONC, 3//DR 4X4 RED SPARE WHL, 25.99

Data MATCHBX--72, 69, BUIK, 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

Data "End", 0

Return
'


' ***** Calculate Answer *****
CalculateAnswer:

Let Totalcollec = Totalcollec + Price


Return

' ***** Print Detail *****
PrintDetail:

PRINT USING D1$; Nam$, Yr, Make, Model, Description, Price

RETURN


' ***** Print Totals *****
PrintTotals:

PRINT

PRINT USING TL$; Totalcollec

PRINT

RETURN

' ***** End of Program *****

Jack002
Newbie
Posts: 5
Joined: Wed Jul 10, 2013 1:28 pm

Re: Receiving Syntax error on homework (Code included)

Post by Jack002 » Wed Apr 03, 2019 2:31 pm

Those data statements, none of the strings is inside "s. You have to have "s for strings

Jack002
Newbie
Posts: 5
Joined: Wed Jul 10, 2013 1:28 pm

Re: Receiving Syntax error on homework (Code included)

Post by Jack002 » Wed Apr 03, 2019 2:34 pm

Crap, I just saw this. Looks like you are well past your due date, so maybe its ok. We can still learn. :shock:
http://petesqbsite.com/phpBB3/viewtopic.php?f=1&t=3448

Post Reply