01-19-2004, 10:48 PM
Ok I have most of the program done but I can't figure out where to insert my accumulators for gender. It should be like
tot.male = tot.male + male and
tot.female = tot.female + female
Your help is greatly appreciated
tot.male = tot.male + male and
tot.female = tot.female + female
Code:
GOSUB Start
GOSUB Process
GOSUB Finish
END
Start:
PRINT " NORWOOD HIGH SCHOOL"
PRINT " ROOM ASSIGNMENT REPORT"
PRINT " ======================"
PRINT
PRINT
PRINT "Room Student"
PRINT
D1$ = "\ \ \ \"
T1$ = "Male Students = #"
T2$ = "Female Students = #"
T3$ = "Total Students For Room = #"
T4$ = "Total Male Students = ##"
T5$ = "Total Female Students = ##"
T6$ = "Total Students = ##"
READ room$, name$, gender$
hold.room$ = room$
RETURN
Process:
DO UNTIL room$ = "EOF"
IF hold.room$ = room$ THEN
IF gender$ = "M" THEN
male = male + 1
ELSE
female = female + 1
END IF
count = count + 1
PRINT USING D1$; room$; name$
ELSE
PRINT USING T1$; male
PRINT USING T2$; female
PRINT USING T3$; count
PRINT
count = 0
male = 0
female = 0
hold.room$ = room$
PRINT USING D1$; room$; name$
count = count + 1
male = male + 1
END IF
tot.count = tot.count + 1
READ room$, name$, gender$
LOOP
RETURN
Finish:
PRINT USING T1$; male
PRINT USING T2$; female
PRINT USING T3$; count
PRINT
PRINT USING T4$; tot.male
PRINT USING T5$; tot.female
PRINT USING T6$; tot.count
RETURN
DATA 101, Joseph Bishop, M
DATA 101, Paul Burke, M
DATA 101, Marge Hackett, F
DATA 101, Beth Foster, F
DATA 101, Julia Jefferson, F
DATA 101, Daniel Munn, M
DATA 101, Barbara Tipton, F
DATA 202, Patrick Collins, M
DATA 202, Kyle Durkee, M
DATA 202, Brian Luire, M
DATA 202, Miguel Perez, M
DATA 202, Nancy Symans, F
DATA 202, George Fassio, M
DATA 303, Charles Howard, M
DATA 303, Virginia Murray, F
DATA 303, Carol Palm, F
DATA 303, Daniel Thomas, M
DATA 303, Carl Tross, M
DATA 303, Lindsey West, F
DATA 303, Stephanie Wyatt, F
DATA EOF,,
Your help is greatly appreciated