Page 1 of 1

HELP! calculating student's average

Posted: Tue Sep 26, 2006 7:33 pm
by jasonkidd007
1

Posted: Wed Sep 27, 2006 4:11 am
by Z!re
So go get "professional" help from your teachers.
And get your fork homework off our forum!

Posted: Wed Sep 27, 2006 5:35 am
by {Nathan}
Put more sanely:

We hate people that ask us to do their homework for them. After all, there ARE over 600 tutorials on this website.

Posted: Sat Sep 30, 2006 6:11 pm
by moneo
Hey guys, I think we were a bit too rough on Jason. Yes, I agree, the post is about homework. However, he's not asking us to do the homework, he's just asking for a little help to fix it up. He also posted a pretty nice program so we can see that he's well ahead on doing the homework.

Give the kid a break!

*****

Re: HELP! calculating student's average

Posted: Sat Sep 30, 2006 6:58 pm
by moneo
jasonkidd007 wrote:......
The program is almost done, i just need professional help to perfect it.
Actually, you program looks good, but has a lot of problems, especially with the nested WHILE/WENDs.

One problem with WHILE/WENDs is that there is no EXIT WHILE. So try to use DO/LOOPs instead where you can get out with an EXIT DO.

Another alternative to your nested WHILE/WENDs is SELECT CASE. Have you used that yet?

By the way, you said you can't use IF, but you used two of them.

PRINT "Wow a mark of"; average; "Holy Cow!"
The reason this message prints in an infinite loop is because it takes the exit out of the WHILE/WEND when counter is >4, it later hits the WEND at the bottom of the program, loops back up to "WHILE numcourses > 0" and starts the counter at 15 all over again.

The last 2 WHILE/WENDs, where you set counter=1 and then loop WHILE counter=1, puts the program into an infinite loop also. What you want here is to get out (finish). Just do a SYSTEM or an END.

WHILE 90 < average <= 100
This is really strange syntax to me, and I've been programming Basic for over 30 years. I compiled your code and got no error, but I don't understand what this statement means.

Good luck.

*****

Posted: Sun Oct 01, 2006 11:45 am
by {Nathan}
moneo wrote:Hey guys, I think we were a bit too rough on Jason. Yes, I agree, the post is about homework. However, he's not asking us to do the homework, he's just asking for a little help to fix it up. He also posted a pretty nice program so we can see that he's well ahead on doing the homework.

Give the kid a break!

*****
I'm afraid of Z!re. :wink:

Posted: Sun Oct 01, 2006 8:00 pm
by moneo
Nathan1993 wrote: .....
I'm afraid of Z!re. :wink:
Nathan, you're not only witty, but you also have a great sense of humor.

*****

Posted: Sun Oct 01, 2006 8:56 pm
by Pete
Guys, there's a difference between someone asking for someone to do their entire homework assignment for them, and someone asking for help on a homework assignment. As you can tell by the almost-finished program that jasonkidd007 wrote, he put in a valiant effort to finish the assignment, and just needed a little bit of help to get his code to work. This kind of post is precisely the reason why this forum exists.

Moneo: thanks for helping him out.

Posted: Tue Oct 03, 2006 7:10 pm
by moneo
Pete, thanks for posting your position on homework. I totally agree with you. That's why I went ahead and tried to help him.

Regards..... Moneo

Posted: Tue Oct 03, 2006 8:44 pm
by sid6.7
moneo wrote:Pete, thanks for posting your position on homework. I totally agree with you. That's why I went ahead and tried to help him.

Regards..... Moneo
i agree thanks for helping him moneo...

he did make an effort... he just didnt make a blank
question asking for help or a weak 3-4 line attempt
at something....

Posted: Wed Oct 04, 2006 10:11 pm
by moneo
Yeah, but like many others, he hasn't come back to acknowledge the help given nor anything.

*****

Posted: Thu Oct 05, 2006 6:04 am
by Z!re
moneo wrote:Yeah, but like many others, he hasn't come back to acknowledge the help given nor anything.

*****
What a surprise...
But yeah, I was harsher than needed, because I forgot to check his postcount. This guy actually has one, and so I should just have left the topic without posting at all. My bad.

Posted: Thu Oct 05, 2006 8:12 pm
by moneo
Z!re wrote:
moneo wrote:Yeah, but like many others, he hasn't come back to acknowledge the help given nor anything.

*****
What a surprise...
But yeah, I was harsher than needed, because I forgot to check his postcount. This guy actually has one, and so I should just have left the topic without posting at all. My bad.
Not to worry. You're kind of post helps to clear the air, and keeps them on their toes.

*****

Re: HELP! calculating student's average

Posted: Wed Nov 01, 2006 5:03 pm
by Patz QuickBASIC Creations
moneo wrote:WHILE 90 < average <= 100
This is really strange syntax to me, and I've been programming Basic for over 30 years. I compiled your code and got no error, but I don't understand what this statement means.
Hmm... It doesn't seem like this would work. Usually $$$ like this will require an AND statement. WHILE 90<average AND average <=100 is usually what it would be. The only use I could think of for this is detecting if the grade went over 100 somehow or became too low (below 90). I'll have to look into this!

Posted: Wed Nov 01, 2006 5:47 pm
by bungytheworm
moneo wrote:Yeah, but like many others, he hasn't come back to acknowledge the help given nor anything.
Or he visited here before Sun Oct 01, 2006 1:11 am and is now too scared :wink:

Code: Select all

 WHILE 90 < average <= 100 
So while 90 is smaller than average that is hundred or less? :lol:
Never seen anything like that. I hope jasonkidd007 comes back and tells what he means (or tried to mean) with that one.

Posted: Fri Nov 03, 2006 1:30 am
by Bulldog
Well no if's hope it works ok. You could also use SELECT CASE but I assumed you wanted only DO LOOP / WHILE WEND.



'Filename: KTDOFOR.BAS
'
'Variable Dictionary
' numcourses - the total number of courses the student took
' total - a running total of all the student's marks
' mark - a mark in one course
' counter - a counter to keep track of the number of times a message
' is printed
' average - the average of all the students marks
'
CLS
PRINT "This program will determine your average on last year's courses"
PRINT "When you have finished entering marks, type a negative number."
PRINT

numcourses = 0
total = 0

DO
'This section makes sure a valid mark is entered
'
DO
CLS
LOCATE 2, 1
INPUT "Please enter a mark ", mark
LOOP UNTIL mark <= 100 AND mark >= 0
tmp = mark

'Increment total and counter
'
numcourses = numcourses + 1
total = total + mark

'Special message for a high mark
'

DO WHILE mark >= 90
counter = 0
PRINT
DO
PRINT "A mark of"; mark; "! Wow!"
counter = counter + 1
LOOP UNTIL counter = 10
Counter = 0
PRINT "Press a key to enter next mark"
PRINT
SLEEP
WHILE LEN(INKEY$): WEND
EXIT DO
LOOP

LOOP WHILE (tmp > 0)

'Make sure at least one mark was entered
'
DO WHILE numcourses > 0
average = total / numcourses

'Special message for a high average
'
DO WHILE average > 90
counter = 15
WHILE counter > 4
counter = counter - 1
PRINT "Wow a mark of"; average; "Holy Cow!"
WEND
EXIT DO
LOOP
DO WHILE average < 90
CLS
PRINT "Your average last year was"; average
EXIT DO
LOOP

DO WHILE average = 0
CLS
PRINT "No marks were entered"
EXIT DO
LOOP
EXIT DO
LOOP





END