Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accumulator Problem
#1
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

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
Reply
#2
Maybe you should try a little harder before asking for homework help?

Just a suggestion:

Quote:IF gender$ = "M" THEN
male = male + 1

Look there.

And do your own damn homework. *argh!*

:rotfl:
Reply
#3
Damn Z!re, someone woke up on the wrong side this morning.

I case you did'nt understand I'm trying to total up the male and female students and add them at the end. Those lines you pointed out are just fine

Ya crabby bastard
Reply
#4
...We just have a policy here of trying to get people to do their own homework, or else they won't learn anything, and the QB teacher's efforts will go to waste.
Don't flame.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#5
Quote:Damn Z!re, someone woke up on the wrong side this morning.

I case you did'nt understand I'm trying to total up the male and female students and add them at the end. Those lines you pointed out are just fine

Ya crabby bastard

If you had half a brain, you would know that he was giving you a hint. And if you want people to help you, calling them names probably won't get you off to a very good start.
Reply
#6
Also, note the smiley " :rotfl: " I was making a joke, relax.

It is a simple problem, to me it looks like you took a quick peek and then decided to go watch Tv instead and let us do it for you.

The code you posted is copied right off the assignment.

You have not made any changes to it (that I can see anyways)

We will NOT do your homework, we WILL help you all we can, but ask a question on your work so far.

I know the lines i pointed out was fine, but you should listen more in class you "crabby bastard", and stop watching TV, drinking bear, having sex, playing sports.

My advice: become a monk.. or Stare into a wall, it would do you good :rotfl:

Code:
IF you = offended THEN iWasMakingaJoke=TRUE:doYourOwnHomework = TRUE ELSE doYourOwnHomework = TRUE
Reply
#7
personally, I think this guy did it right: He posted what he had and he asked for help on a specific part. Z!ire was very much in the wrong. Granted, the newb shooting back with an insult probably wasn't a great move either but I can't say that I wouldn't have done the same in his position.

BTW -- at first glance it looks like you might be resetting all your count variables within the loop, which means no matter how many times you add 1 to it, it's going back to 0 when it reaches those lines.
Reply
#8
Quote:Z!ire was very much in the wrong.lines.

I know the assignment:
you get the exact same code JJRJRM143
the assignment:

add tot.males and tot.females and make it display those values at the end of the program

Now. Please tell me what he wanted help with?

Ohh and by the way stevie, I have an english essay, heres what I have:

Once upon a time.

I have to make it a A+ essay until tomorrow, can you please help me?

No offense intended, just making my point. 8)
Reply
#9
you should be thankful that you have a qb class. i dont... Sad
Reply
#10
You should be thankful you have *any* computers/programming course - I don't have any.
People obviously think that only those above the age of 14 are worthy to study programming. :roll:
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)