Saturday
April 19, 2014

Homework Help: QBASIC, Computers question 2

Posted by Jason on Thursday, November 29, 2012 at 12:36pm.

Why do I keep getting a Type Mismatch error on this line? Also, when i click "View" to view my output screen its blank, so nothing is printing.... can so please help me resolve this?

PRINT USING D$; NAM$; VehicleType$; DaysHeld; Miles; Charge

My Code:

'************************************
'* THIS PROGRAM IS TO CALCULATE CAR RENTAL REVENUE GENERATED *
'*************************************
'VARIABLE USED:
'T1$, H1$, H2$, D1$
'NAM$ Customer Name
'VehicleType$ Vehicle Type
'MILAGE Miles Traveled
'RATE Vehicle Rate
'DaysHeld Days Held
'TOTAL Total Revenue Generated Per Account
'Charge Charge for the car rental

'*************************************
'* PROGRAM MAINLINE *
'*************************************
CLS
GOSUB InitializeVariables
GOSUB PrintHeadings
GOSUB CalculateTotal
END

'*************************************
'* INITILIZE VARIABLES *
'*************************************

InitializeVariables:
LET T$ = " CAR RENTAL "
LET H$ = " Customer Vehicle Days Miles Total Cost"
LET H$ = " Name Type Held Traveled For Rental"
LET D$ = "/ / ## #### ######"

'*************************************
'* PRINT HEADINGS *
'*************************************
PrintHeadings:
PRINT
PRINT T1$ 'Print Title Line
PRINT
PRINT H1$ 'Print Column Heading, Line 1
PRINT H2$ 'Print Column Heading, Line 2
PRINT
RETURN

' ********************************
' Calculate Total
' ********************************

CalculateTotal:
GOSUB ReadData
DO UNTIL NAM$ = "END"
IF VehicleType$ = "Compact" THEN
LET Cost = 10
LET Rate = .15
ELSEIF VehicleType$ = "Intermediate" THEN
LET Cost = 20
LET Rate = .18
ELSE
LET Cost = 30
LET Rate = .22
END IF
LET Charge = Cost * DaysHeld + Rate * Miles
PRINT USING D$; NAM$; VehicleType$; DaysHeld; Miles; Charge
GOSUB ReadData
LOOP
RETURN

'*************************************
'* READ DATA *
'*************************************

ReadData:
READ NAM$, VehicleType$, DaysHeld, MilesTraveled
DATA "Jones","Large",6,500
DATA "Smith","Compact",17,3000
DATA "Baker","Intermediate",8,250
DATA "Williams","Intermediate",4,1000
DATA "Winston","Large",3,500
DATA "END"
RETURN


'*************************************
'* END OF PROGRAM *
'*************************************

Answer this Question

First Name:
School Subject:
Answer:

Related Questions

Math - You are required to design a QBASIC program that recieves a student test ...
Math - how do you solve this I keep trying and I keep getting the wrong answer. ...
Math - Im having trouble getting the correct answer to this question. Could ...
PHYSICS - Could u help with physics hw! i keep trying but i keep getting the ...
Calculus - Need an answer to this Calculus Question. I keep getting this type of...
Physics - Suppose a nucleus of 93X236 fissions into two fragments whose mass ...
Chemistry - Okay, so here's the question: A 60.0 mL sample of 0.100M CH3COOH is ...
computers - what computers can do?what computers cannot do?what are the ...
algebra - I keep getting different answers to this 1 question..hoping some1 can ...
math - 4m+9+5m-12= 42 my question is how to get m=5 (the answer) can u show me ...

Search
Members