05-13-2004, 08:12 AM
It doesn't seem to print the names or the Penalties or amounts where they are suppose to be. Could someone tell me what I did wrong.
Thank You
'Driver Routine
GOSUB initialize
GOSUB print.headings
GOSUB process.file
GOSUB finish.prints
GOSUB wrap.up
END
'_____________________________________________________________________________
'Initialization of Program
initialize:
CLS
p1$ = " Name Fine Penalty Amount"
p2$ = " ---- ---- ------- ------"
p3$ = "\ \ $## $## $## "
LET zero = 0
RETURN
'_____________________________________________________________________________
'Printing of Heading Lines
print.headings:
PRINT SPC(25); "Charlestown Police Department"
PRINT SPC(28); "Traffic Citation Report"
PRINT
PRINT
PRINT p1$
PRINT p2$
PRINT
RETURN
'_____________________________________________________________________________
'Processing of Records and Calculations
process.file:
READ off.name$, violation.type$, violation.num
DO UNTIL off.name$ = "EOF"
LET total.tickets = total.tickets + 1
IF violation.type$ = "m" THEN
LET fine.amnt = 30
LET total.moving = total.moving + 1
END IF
IF violation.type$ = "n" THEN
LET fine.amnt = 10
LET total.non.moving = total.non.moving + 1
END IF
LET total.fines = total.fines + fine.amnt
IF violation.num > 3 THEN
LET pen.amnt = 20
ELSE
LET pen.amnt = 0
END IF
LET total.pen = total.pen + pen.amnt
LET total.payment = fine.amnt + pen.amnt
LET total.amnt = total.amnt + total.payment
LPRINT USING p3$; off.name$; fine.amnt; pen.amnt; total.payment
READ off.name$, violation.type$, violation.num
LOOP
RETURN
'=============================================================================
'Printing Totals
finish.prints:
PRINT
PRINT
PRINT "Total Tickets "; total.tickets
PRINT "Total Moving Violations "; total.moving
PRINT "Total Non-Moving Violations "; total.non.moving
PRINT "Total Fines $"; total.fines
PRINT "Total Penalties $"; total.pen
PRINT "Total Amount Due $"; total.amnt
RETURN
'=============================================================================
'wrapping up
wrap.up:
PRINT
PRINT
PRINT
PRINT "End of Job"
RETURN
'=============================================================================
' The Following are All Data Records
DATA Jason Haines, m, 2
DATA Tom Lions, n, 6
DATA June Plamenza, m, 4
DATA Dale Collins, n, 1
DATA EOF, 0, 0
Thank You
'Driver Routine
GOSUB initialize
GOSUB print.headings
GOSUB process.file
GOSUB finish.prints
GOSUB wrap.up
END
'_____________________________________________________________________________
'Initialization of Program
initialize:
CLS
p1$ = " Name Fine Penalty Amount"
p2$ = " ---- ---- ------- ------"
p3$ = "\ \ $## $## $## "
LET zero = 0
RETURN
'_____________________________________________________________________________
'Printing of Heading Lines
print.headings:
PRINT SPC(25); "Charlestown Police Department"
PRINT SPC(28); "Traffic Citation Report"
PRINT p1$
PRINT p2$
RETURN
'_____________________________________________________________________________
'Processing of Records and Calculations
process.file:
READ off.name$, violation.type$, violation.num
DO UNTIL off.name$ = "EOF"
LET total.tickets = total.tickets + 1
IF violation.type$ = "m" THEN
LET fine.amnt = 30
LET total.moving = total.moving + 1
END IF
IF violation.type$ = "n" THEN
LET fine.amnt = 10
LET total.non.moving = total.non.moving + 1
END IF
LET total.fines = total.fines + fine.amnt
IF violation.num > 3 THEN
LET pen.amnt = 20
ELSE
LET pen.amnt = 0
END IF
LET total.pen = total.pen + pen.amnt
LET total.payment = fine.amnt + pen.amnt
LET total.amnt = total.amnt + total.payment
LPRINT USING p3$; off.name$; fine.amnt; pen.amnt; total.payment
READ off.name$, violation.type$, violation.num
LOOP
RETURN
'=============================================================================
'Printing Totals
finish.prints:
PRINT "Total Tickets "; total.tickets
PRINT "Total Moving Violations "; total.moving
PRINT "Total Non-Moving Violations "; total.non.moving
PRINT "Total Fines $"; total.fines
PRINT "Total Penalties $"; total.pen
PRINT "Total Amount Due $"; total.amnt
RETURN
'=============================================================================
'wrapping up
wrap.up:
PRINT "End of Job"
RETURN
'=============================================================================
' The Following are All Data Records
DATA Jason Haines, m, 2
DATA Tom Lions, n, 6
DATA June Plamenza, m, 4
DATA Dale Collins, n, 1
DATA EOF, 0, 0
oseph L. Gelsomino