Illegal Function Call?
Posted: Tue Oct 02, 2012 12:37 pm
Hey guys,
Im writing a program for my BASIC class and have suddenly gotten an "Illegal Function Call" error on one of the lines and I really dont know why
The error occurs at the "PRINT USING T1$; PageCt 'Print title line" line
' MINITEST 2
' Variables Used:
' T1$, H1$, H2$, D1$ Print images
' TL$ Print images
' Nam$ Names
' Num Number of people
' Rate Hourly Rate
' AmountOwed Amount Owed
' NumTot Number Totals
' AmountTot Amount Total
' **********************************************
' * PROGRAM MAINLINE *
' **********************************************
CLS
GOSUB InitializeVariables
GOSUB PrintHeadings
GOSUB ProcessDetail
GOSUB PrintTotals
END
' *********************************************
' * Initialize Variables *
' *********************************************
InitializeVariables:
LET Rate = 0
LET Num = 0
LET NumTot = 0
LET AmountTot = 0
' ***********************************************
' Initialize Images
' ************************************************
InitializeImages:
' T1$ Title Outputs
' H1$, H2$ Column Headings
' D1$ Detail (names, # of people, amount owed>
' TL$ Totals
' ****************************************************
' LPRINT HEADINGS *
' ****************************************************
PrintHeadings:
PRINT USING T1$; PageCt 'Print title line
PRINT
PRINT H1$ 'Print column headings, line 1
PRINT H2$ 'Print column headings, line 2
PRINT
RETURN
' *******************************************************
' * PROCESS DETAIL *
' *******************************************************
ProcessDetail:
GOSUB ReadData 'Prime Nam$, Num
LET Names$ = Nam$
DO UNTIL Nam$ = "END"
RateLookup:
IF Num <1>= 1 AND Num <4> 11 THEN
LET Rate = 100
END IF
LOOP
RETURN
' *************************************************
' * READ DATA *
' *************************************************
ReadData:
READ Nam$, Num, AmountOwed
DATA ABC company, 5, $80.00
DATA NBC Corporation, 7, $80.00
DATA XLR company,8, $80.00
DATA Lucent corp, 12, $60.00
DATA Ameritech, 3, $100.00
DATA Rambo Mart, 0, $0
DATA END, 0,0,0
RETURN
' **************************************************
' * Calculate Amount Owed *
' **************************************************
AmountOwed:
LET AmountOwed = Rate * Num
RETURN
' **************************************************
' * CALCULATE TOTALS *
' **************************************************
CalculateTotals:
LET NumTot = NumTot + Num 'Add to number total
LET AmountTot = AmountTot + AmountOwed 'Add to amount total
RETURN
' **************************************************
' * LPRINT DETAILS *
' ***************************************************
PrintDetail:
LPRINT USING D1$; Nam$; Num; AmountOwed 'Print details
RETURN
' ******************************************************
' * LPRINT TOTALS *
' *******************************************************
PrintTotals:
LPRINT
LPRINT USING TL$; NumTot; AmountTot ' Print totals line
RETURN
' *****************************************************************
' * END OF PROGRAM *
' *****************************************************************
Anyone have any ideas?
Thanks for the help!
Im writing a program for my BASIC class and have suddenly gotten an "Illegal Function Call" error on one of the lines and I really dont know why
The error occurs at the "PRINT USING T1$; PageCt 'Print title line" line
' MINITEST 2
' Variables Used:
' T1$, H1$, H2$, D1$ Print images
' TL$ Print images
' Nam$ Names
' Num Number of people
' Rate Hourly Rate
' AmountOwed Amount Owed
' NumTot Number Totals
' AmountTot Amount Total
' **********************************************
' * PROGRAM MAINLINE *
' **********************************************
CLS
GOSUB InitializeVariables
GOSUB PrintHeadings
GOSUB ProcessDetail
GOSUB PrintTotals
END
' *********************************************
' * Initialize Variables *
' *********************************************
InitializeVariables:
LET Rate = 0
LET Num = 0
LET NumTot = 0
LET AmountTot = 0
' ***********************************************
' Initialize Images
' ************************************************
InitializeImages:
' T1$ Title Outputs
' H1$, H2$ Column Headings
' D1$ Detail (names, # of people, amount owed>
' TL$ Totals
' ****************************************************
' LPRINT HEADINGS *
' ****************************************************
PrintHeadings:
PRINT USING T1$; PageCt 'Print title line
PRINT H1$ 'Print column headings, line 1
PRINT H2$ 'Print column headings, line 2
RETURN
' *******************************************************
' * PROCESS DETAIL *
' *******************************************************
ProcessDetail:
GOSUB ReadData 'Prime Nam$, Num
LET Names$ = Nam$
DO UNTIL Nam$ = "END"
RateLookup:
IF Num <1>= 1 AND Num <4> 11 THEN
LET Rate = 100
END IF
LOOP
RETURN
' *************************************************
' * READ DATA *
' *************************************************
ReadData:
READ Nam$, Num, AmountOwed
DATA ABC company, 5, $80.00
DATA NBC Corporation, 7, $80.00
DATA XLR company,8, $80.00
DATA Lucent corp, 12, $60.00
DATA Ameritech, 3, $100.00
DATA Rambo Mart, 0, $0
DATA END, 0,0,0
RETURN
' **************************************************
' * Calculate Amount Owed *
' **************************************************
AmountOwed:
LET AmountOwed = Rate * Num
RETURN
' **************************************************
' * CALCULATE TOTALS *
' **************************************************
CalculateTotals:
LET NumTot = NumTot + Num 'Add to number total
LET AmountTot = AmountTot + AmountOwed 'Add to amount total
RETURN
' **************************************************
' * LPRINT DETAILS *
' ***************************************************
PrintDetail:
LPRINT USING D1$; Nam$; Num; AmountOwed 'Print details
RETURN
' ******************************************************
' * LPRINT TOTALS *
' *******************************************************
PrintTotals:
LPRINT
LPRINT USING TL$; NumTot; AmountTot ' Print totals line
RETURN
' *****************************************************************
' * END OF PROGRAM *
' *****************************************************************
Anyone have any ideas?
Thanks for the help!