User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 31 Oct 2006, 10:52   #1
Androme
☆ ♥ 
 
Androme's Avatar
 
Join Date: Jan 2003
Posts: 3,489
Androme can only hope to improve
[Java] Quiz

I'm looking to create a tree diagram quiz. To start off basically, what is a good approach?

By doing a "do ... while bla" loop so more than one player can enter and then having several variables for different questions. (I haven't looked at arrays yet).

But should I do it like this: question_one = JOptionPane.... "What is your fav colour?"

question_two = .......

Or after each question should I do an "if (question_one.equalsIgnoreCase("blue")) ?


After I've obtained all the answers to the different questions I would need to construct a message. Would I have to do another if statement - for example

if (question_one == blue && question_two == red)

But that approach is very long as I would have to do every possibility for the answers in the comparison. Is there a way I can simply based on one individual answer, come up with a line that links to that answer and then do this for every question and every possibility and for the final output add all these lines together.


If I was to modify all of this to rely on arrays, how would I do so to keep a record of the final decisions of each person who played in an array so that at the end all the decisions can be printed out along with the name of the player (they give their name at the start) or store the questions and answers in arrays at the start and have the main body just pull question text from the array?


Thanks for any help.
__________________
R3: LegioN (came #32) || R4: BlueTuba
R5: WolfPack Order || R6: Wolfpack
R7: Fury
----------retired-------
R52-R55: Apprime
R56-R57: FaceLess
R58-60: Apprime/Ultores
Androme is offline   Reply With Quote
Unread 31 Oct 2006, 11:20   #2
Phil^
Insomniac
 
Phil^'s Avatar
 
Join Date: May 2003
Posts: 3,583
Phil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus wouldPhil^ spreads love and joy to the forum in the same way Jesus would
Re: [Java] Quiz

what do you mean by tree diagram quiz
are you basically just going to be asking a lot of questions and have to do something depending on how they answered? If so , store each question and answer pair in an arraylist or something, ask all the questions and then work through them at the end applying whatever logic is necessary depending on how they answered
__________________
Phil^

Last edited by Phil^; 31 Oct 2006 at 11:28.
Phil^ is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 08:16.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018