aspose file tools*
The moose likes Java in General and the fly likes Help needed for a quiz application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Help needed for a quiz application" Watch "Help needed for a quiz application" New topic
Author

Help needed for a quiz application

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9426
    
    2

Guys,

I'm planning to build a sample quiz site. I need to have an idea on how the logic is to be built. I'm not planning to go for a database, but rather I'm going to hard code around 50 questions along with it;s answers in a class and call that class with a random number, so that I get different questions each time. Any idea on how this can be done? I'm planning to use multi dimensional arrays. Below is a sample of what I tried,

public class QuestionsClass {
int k = 0;
/** Creates a new instance of QuestionsClass */
public QuestionsClass() {}

public String[] getRandom() {
return getQuestions((int)Math.random());
}

public String[] getQuestions(int num) {
String [][] testString = new String[3][];
testString[0] = new String[]{"what is a servlet", "class", "java", "kava", "bava"};
testString[1] = new String[]{"what is a jsp", "dsp", "ksp", "ssp", "rsp"};
testString[2] = new String[]{"Is this good", "yes", "no", "maybe", "dontknow", "getlost"};
return testString[num];
}
}


Any idea on how I can do this?? I want it to be like this,

The user answers the first question and he clicks submit, and on submit I'll put the answer in a session and on call the same page again which will in turn talk to the QuestionClass and get another question....Any ideas on how I can improvise on this?
[ October 18, 2007: Message edited by: Jothi Shankar Kumar Sankararaj ]

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9426
    
    2

I know that patience is a virtue, but still help me guys!
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
Jothi, you are probably not getting any posts because this post is in the wrong forum...
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
OK, what do you have so far apart from the class that you have mentioned?

I assume that you will be using a servlet/jsp architecture. Any framework like Struts?
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
Wrong forum, and your question probably needs to be narrower in scope.


SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9426
    
    2

Am I receiving any help?
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
Yes, you are getting plenty of help. What you are not getting is someone doing it for you.

Help us help you.

I ask you again, except for the one class you mentioned what else have you done? Where are you stuck?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help needed for a quiz application