Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with my survey program!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mrtorelli




PostPosted: Tue Jan 24, 2006 1:53 pm   Post subject: Help with my survey program!

Hey, I need some help with my current survey program. If anyone has any ideas on how to make it really good so I can get a really good mark.

Below is what i have so far.
Thanks!
Stefan

code:
var userchoice:string
var score:=0
%First Question
loop
put "What Year Did The September 11th Attacks Occur On?"
put "a) 2000"
put "b) 2001"
put "c) 2002"
put "d) 2003"
get userchoice
if userchoice = "a" or userchoice = "A" then
score:= score - 1
put "Sorry, that is incorrect, Your Current Score is ", score
exit
elsif userchoice = "b" or userchoice = "B" then
score:= score + 1
put "Yes, you are correct, Your Current Score is " , score
exit
elsif userchoice = "c" or userchoice = "C" then
put "Sorry, that is incorrect, Your Current Score is ", score
exit
elsif userchoice = "d" or userchoice = "D" then
put "Sorry, that is incorrect, Your Current Score is ", score
exit
else
put "Entry is invalid, try again"
end if
end loop
%End Of First Question

%Second Question
loop
put "What Is The Ice Cubes Real Name?"
put "a) Jajuan"
put "b) Tywan"
put "c) O'Shea Jackson"
put "d) Dameane"
get userchoice
if userchoice = "a" or userchoice = "A" then
score:= score - 1
put "Sorry, that is incorrect, Your Current Score is ", score
exit
elsif userchoice = "b" or userchoice = "B" then
put "Sorry, that is incorrect, Your Current Score is ", score
exit
elsif userchoice = "c" or userchoice = "C" then
score:= score + 1
put "Yes, you are correct, Your Current Score is " , score
exit
elsif userchoice = "d" or userchoice = "D" then
put "Sorry, that is incorrect, Your Current Score is ", score
exit
else
put "Entry is invalid, try again"
end if
end loop
%End Of Second Question
[/quote]
Sponsor
Sponsor
Sponsor
sponsor
Albrecd




PostPosted: Tue Jan 24, 2006 2:22 pm   Post subject: (No subject)

Why would a survey have incorrect answers???

Please be more specific with what you want, there are many ways to make your program look good.
sylvester-27




PostPosted: Tue Jan 24, 2006 2:35 pm   Post subject: (No subject)

what albrecd is saying is that all you need is and "if" statement for the correct answer and for the incorrect ones, use a "else"
code:
if userchoice = "a" then
put "That is correct"
else
put "That is incorrect"

Also, why are you looping each question? Just loop the entire program and make the survey (also this is not a survey. this is a multiple choice program. survey involves yes or no or explain questions) record data from multiple users.
Albrecd




PostPosted: Tue Jan 24, 2006 2:48 pm   Post subject: (No subject)

Quote:
what albrecd is saying is that all you need is and "if" statement for the correct answer and for the incorrect ones, use a "else"


That is not what I said at all! I was questioning how you could get the wrong answer on a survey.

Anyway, instead of using "if userchoice = "b" or userchoice = "B" then" you could use the Str.Upper or Str.Lower commands to convert the answer to one case (provided you have a version of Turing that supports this) or create a function to do this yourself.
Rasta Fella




PostPosted: Tue Jan 24, 2006 3:07 pm   Post subject: (No subject)

Wait let's get things clear first...surveys DO NOT have INNCORRECT answers...that's what Albrecd was trying to say. Second I prefer you change the title of your program from SURVEY to QUIZ. Hope that clarifies everything up.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: