954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

New user needs a little help on homework here :<

Hey there, i have been given a task to complete as home work for college and i seriously have no idea how to do it, hopeing one of you guys would be able to shed some light on it for me?
Well here it is.
You have been asked to create a program that prompts the user for the score for a multiple choice test; there are 20 questions, each questions scores 0 or 1 point (i.e no half-points), so the max score a student can achieve is 20, and the minimum score is 0.The program will loop with the folowing complex condition, written here in pseudocode:
WHILE(SCORE>=0) AND(SCORE<=20) DO

The number of people in a class varies, so loop until a score outside the range has been typed in (check to make sure that this number does not get included in with the test scores and class average). After the loop is finished, display the clas average, and the total number of people who took the test.

Any help that anyone could shed on this would be greatly appreciated.

Greg

Gregry254
Newbie Poster
2 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

1)i'm not sure that condition is good. you must continue with questions until all the questions have an answer.
2)post what you have accomplished until now, so we can help you

best regards,

radu84
Junior Poster
171 posts since Dec 2006
Reputation Points: 14
Solved Threads: 16
 

Im sorry i really dont understand the questions at all, i have been off college for like a month and that is when the software dev class started, if i dont get this done by friday i fail :'(

Gregry254
Newbie Poster
2 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 
Im sorry i really dont understand the questions at all, i have been off college for like a month and that is when the software dev class started, if i dont get this done by friday i fail :'(

my friend, you don't ask for help, you're asking the program! http://www.daniweb.com/techtalkforums/announcement124-2.html

i explained you before, you must make a loop for all the clases selected, inside it another loop for each student from that class, and finally a loop which will count the questions

radu84
Junior Poster
171 posts since Dec 2006
Reputation Points: 14
Solved Threads: 16
 

You state that valid scores are 0 through 20 and the number of scores is unknown, so your condition is correct. You need to do the loop until an invalid score (say -1) is entered. Within the loop, you need to add the score to a tally variable and incriment a second count variable. When you exit the loop, divide the sum of the scores by the number of scores to get your average. While most Pascal systems will set the initial value of your variables to zero, it is always a good idea to do so in code anyway before you enter the loop.

Terry Robinson
Light Poster
27 posts since Apr 2007
Reputation Points: 12
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You