• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Help needed for a quiz application

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know that patience is a virtue, but still help me guys!
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jothi, you are probably not getting any posts because this post is in the wrong forum...
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wrong forum, and your question probably needs to be narrower in scope.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Am I receiving any help?
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Are you here to take over the surface world? Because this tiny ad will stop you!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic