Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why is this not working?
#1
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
oseph L. Gelsomino
Reply
#2
Hmm... I Think it may have something to do with your format.
(I am not a great programmer. So don't be mad if I don't fix it.)
I have not seen LPRINT before, and I am assuming that you have DIMensioned those premade TYPEs. Oh, and if you want to have a $ sign in front of a number, use 2 $$ ($$) in front of it. This probably hasn't helped you alot. Sorry.
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#3
I am still not able to get it to do what it is suppose to do. It will print the header, but woin't print any of the names. I was able to get it to do it once, but it wouldn't give me the fines in the field it only gave me 0's. As far as the LPRINT that only to send it to the printer.
oseph L. Gelsomino
Reply
#4
It works okay for me. I changed P1$, P2$ and P3$ to change the spacing. I also changed the LPRINT to PRINT so that everything went the screen.
Code:
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

PRINT 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
Note: please use code tags. They can make the code easier to read, and they avoid unwanted smileys.

Look up LOCATE. It is a much better way to control print position.

LET is still valid in QB, but it's unnecessary.
Code:
LET A = 32
is the same as
Code:
A = 32
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)