| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|
#1 (permalink) |
|
Member
Join Date: Jan 2007
Age: 27
Posts: 83
Thanks: 1 Thanked 2 Times in 2 Posts Thanks: 1
Thanked 2 Times in 2 Posts
Rep Power: 2
|
In applets - Need solution for the problem
Hi everybody,
Any one say to this question The content is What is your name? radio buttons 4 options what is .. radio button option ... like this 10 questions in each page totally is 1500questions and the correct answer and other options must be generated in xml and that must be stored and retrieved. Say immediately to this please. |
|
|
|
|
|
#2 (permalink) |
|
Super Moderator
Join Date: Feb 2006
Location: Hyderabad
Posts: 2,355
Thanks: 117 Thanked 241 Times in 198 Posts Thanks: 117
Thanked 241 Times in 198 Posts
Blog Entries: 4
Rep Power: 51
|
Re: In applets
Chaitanya, please frame the question more clearly and state what you are looking for. This will help people to give more appropriate answers.
Thanks, Krishna
__________________
Give 1 cup rice to a hungry Indian just by a mouse click. No money, no form filling, no hassle... Click here for the donation. |
|
|
|
|
|
#3 (permalink) |
|
Moderator
Join Date: Apr 2006
Location: India
Posts: 636
Thanks: 57 Thanked 78 Times in 63 Posts Thanks: 57
Thanked 78 Times in 63 Posts
Rep Power: 17
|
Re: In applets
I agree with kireeti, The question is not at all clear chaitanya,If you can frame it properly and give it then we can answer your question
__________________
M0h@n |
|
|
|
|
|
#4 (permalink) |
|
Member
Join Date: Jan 2007
Age: 27
Posts: 83
Thanks: 1 Thanked 2 Times in 2 Posts Thanks: 1
Thanked 2 Times in 2 Posts
Rep Power: 2
|
Re: In applets
hi every body keeriti and mohan
This is the design should be in applets and store in xml 1.what is your name? radio buttons choose with options. 2........ radio buttons choose with options. .... . . . . like this per page 10to 15questions must display and total it accepts 1500 questions. This must be stored and retrieve correct answer from xml . and choose randomly must be their checking of answer ..... please tell immediately. |
|
|
|
|
|
#5 (permalink) |
|
Moderator
Join Date: Apr 2006
Location: India
Posts: 636
Thanks: 57 Thanked 78 Times in 63 Posts Thanks: 57
Thanked 78 Times in 63 Posts
Rep Power: 17
|
Re: In applets
Hi chaitanya
Take this as a technical design and do it the same way as i suggested you, If you are struct anywhere you tell me,I'll tell u 1st) Define an Predefined XML file with the questions, the Tags in the xml should be like this, LEt us assume you are having some sections and in those sections who are having some questions < ExamQuestions > < SectionA > < QuestionId=1 > < QuestionDesc >What is your Name?< / QuestionDesc > < QuestionOpt1 >A.Some Option1< / QuestionOpt1 > < QuestionOpt2 >B.Some Option2< / QuestionOpt2 > < QuestionOpt3 >C.Some Option3< / QuestionOpt3 > < QuestionOpt4 >D.Some Option4< / QuestionOpt4 > < /QuestionId > < QuestionId=2 > < QuestionDesc >What is your Job?< / QuestionDesc > < QuestionOpt1 >A.Some Option1< / QuestionOpt1 > < QuestionOpt1 >B.Some Option2< / QuestionOpt1> < QuestionOpt1 >C.Some Option3< / QuestionOpt1> < QuestionOpt1 >D.Some Option4< / QuestionOpt1> < Answer >D< / Answer> < / QuestionId > < / SectionA > < SectionB > < QuestionId=1 > < QuestionDesc >What is your Native Place?< / QuestionDesc > < QuestionOpt1 >A.Some Option1< / QuestionOpt1 > < QuestionOpt1 >B.Some Option2< / QuestionOpt1 > < QuestionOpt1 >C.Some Option3< / QuestionOpt1 > < QuestionOpt1 >D.Some Option4< / QuestionOpt1 > < Answer >C < / Answer > < / QuestionId > < QuestionId=2 > < QuestionDesc >Where do you work?< / QuestionDesc > < QuestionOpt1 >A.Some Option1< / QuestionOpt1 > < QuestionOpt1 >B.Some Option2< / QuestionOpt1 > < QuestionOpt1 >C.Some Option3< / QuestionOpt1 > < QuestionOpt1 >D.Some Option4< / QuestionOpt1 > < Answer >C < / Answer > < / QuestionId > < / SectionB > < / ExamQuestions > 2nd) Create the applet. Now what you have to do is Pick up a random number, simplest method is using the randomize() method, convert the number written by this method to a string and pick a random number from this string. Depending on the number in the string, pick that question and all its options from your XML and display it on the applet. Note:Here we have a problem, if the number generated by method is not in the question ids range, we'll be having a problem. To solve that, take a range of ur questions in alike MIN_QUESTION_ID and MAX_QUESTION_ID. Check the generated number is in the range of the these two or not, if not continue the loop and generate the number again until it gets equal in between the range specified and then only populate the question with options. 3rd) at first,when the applet is inited, then create blank XML file with a root node , with some Id , like AnswerM1.xml , if the file is already existing then create another AnswerM2.xml, because AnswerM1.xml may be created by someone else instance. This procedure should be followed subsequently for different instances i,e ur logic should be in a such a way, if some instance has created a file, then the subsequent file with different id should be created Here your root node can be like this 4th) After clicking on next(ie, user answered for a question), if the question is from section A, then append the sectionA closing and ending tags to the rootnode of your answers xml ,followed by questionid ,followed by answer.If once a section is appended to the root node, u should notappend it always,only the questionid and answer should be appended if the question belongs to the same section so this is the process to be followed So after the user answering all the questions,then ur xml should look like this < ExamAnswers > < SectionA > < QuestionId=1 > < /QuestionId > < QuestionId=2 > < Answer >D< / Answer> < / QuestionId > < / SectionA > < SectionB > < QuestionId=1 > < Answer > C < / Answer > < / QuestionId > < QuestionId=2 > < Answer >C < / Answer > < / QuestionId > < / SectionB > < / ExamQuestions > After clicking on the final submit, compare the results in the AnswersXML file with that of the QuestionsXML file by using a helper methods and objects and display the final result Please follow this carefully, if you have any doubts in the design you can feel free to ask me Important note: To read the xml, create xml, etc etc basically u hve to use this jars in ur application, dom4j.jar,xalan.jar,xercesImpl.jar,sax.jar,saxpath.jar and also the JAXP Parsers(it is within java) Let me know your questions Thank You
__________________
M0h@n Last edited by t_mohan; 22-02-07 at 01:51 PM. |
|
|
|
|
|
#7 (permalink) |
|
Moderator
Join Date: Apr 2006
Location: India
Posts: 636
Thanks: 57 Thanked 78 Times in 63 Posts Thanks: 57
Thanked 78 Times in 63 Posts
Rep Power: 17
|
Re: In applets
come'on chaitanya, We are here to help you in finding a solution, It is a mini project, and it takes too much time to complete the application. Based on the solution given above you have to try. If we write the code and give it to you then what will u do and what will u learn. There wont be anything to learn if we give the code.
Never u learn if u get the code. you have to try urselves and if u have any problem,ask us and we'll try to solve ur problem And i dont think anyone in this forum/any forum will spare that much time to write down the complete code for this project. And for this solution to write it down, it took me 45 minutes Pls dont mind, and dont think otherwise, i think this is a good suggestion and hope u follow it. Any thoughts gals/guyz Thank You
__________________
M0h@n Last edited by t_mohan; 22-02-07 at 03:28 PM. |
|
|
|
|
|
#8 (permalink) |
|
Super Moderator
Join Date: Feb 2006
Location: Hyderabad
Posts: 2,355
Thanks: 117 Thanked 241 Times in 198 Posts Thanks: 117
Thanked 241 Times in 198 Posts
Blog Entries: 4
Rep Power: 51
|
Re: In applets
Chaitanya,
I completely agree with Mohan. Here we can only help you to show path. Its you who have to walk through it. Any case, I have few amendments/siggestions which can help you to arrive at a better solution. Step 1 : No comments. Even though it has many approaches, this one looks perfect. Step 2 : I think you can control the range for a random number generation code. I did it long. Don't remember how to do it. Try to figure it out to generate a random number between give 2 numbers (minimum , maximum). Otherwise, use modular operation to generate number from the one the function has generated. Eg: RAND_NUMBER%MAX_QUESTION_SEQ_NUM This will avoid use of loop to generate random number with in acceptable range. Step 3 : Create answer file with a timestamp optionally attached with user name or login id. This will always generate a unique name you don't even have to check if that exist or not. Step 4 : No suggestions. Thanks, Krishna
__________________
Give 1 cup rice to a hungry Indian just by a mouse click. No money, no form filling, no hassle... Click here for the donation. |
|
|
|
| The Following User Says Thank You to sk_kireeti For This Useful Post: |
t_mohan (27-02-07)
|
|
|
#9 (permalink) |
|
Moderator
Join Date: Apr 2006
Location: India
Posts: 636
Thanks: 57 Thanked 78 Times in 63 Posts Thanks: 57
Thanked 78 Times in 63 Posts
Rep Power: 17
|
Re: In applets
Hi kireeti,
Thanx for the Step2 and Step3 changes, and i completely agree with ur suggestion. As it is nothing but the best code optimization technique. Actually i wanted to suggest it but on a hurry i gave the solution and got tired in typing this long post and could not able to think about the solution u gave it at the time of preparing this design. Thank you very much kireeti
__________________
M0h@n |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| There was a problem on solution water and milk kept in | m.gayatri | Aptitude Questions | 0 | 24-01-07 02:37 PM |
| Network problem required solution | pmahesh | NETWORK ADMINISTRATION , HARDWARE & TROUBLESHOOTING | 0 | 20-11-06 11:59 AM |
| Simple solution to a complex problem | AjayKumar.Kataram | Inspire yourself & Others - Leaders Zone | 3 | 10-10-06 12:30 PM |
| System Problem | au123 | NETWORK ADMINISTRATION , HARDWARE & TROUBLESHOOTING | 4 | 09-10-06 10:59 PM |