1 2 Previous Next 22 Replies Latest reply: Nov 22, 2012 8:56 AM by TPD-Opitz Go to original post RSS
      • 15. Re: Java questionaire app
        TPD-Opitz
        797836 wrote:
        Now tell me how we can do the randomization
        Sir, yes Sir!
        http://docs.oracle.com/javase/7/docs/api/java/util/Random.html
        and how we can label the questions which is been answered?
        This depends on your data storrage. Ideally you'd have a database holding the questions. Then you could simpla add a table that stores the question ID, the user id and the ID of the answer (when given). this way you can later track wich user passed and wich failed.

        The minimal solution is to put a bean in the session context of the application server, but then the information will be lost when the session expires.

        bye
        TPD
        • 16. Re: Java questionaire app
          EJP
          To make it clear, I am working on a project that requires me to create a class containing 20 questions and then I have to randomly select 5 questions with the respective answers in objectives (4 of them)
          Is there some good reason why you didn't mention that 11 days ago when you first asked for help? Or is it possible that you are still discovering requirements? In which case asking for a solution is considerably premature.
          • 17. Re: Java questionaire app
            800839
            Thanks. Honestly I was working on the requirements as we havent got the exact requirement which we are looking for.Now we got the exact picture of what we need to do.
            • 18. Re: Java questionaire app
              gimbal2
              797836 wrote:
              Thanks. Honestly I was working on the requirements as we havent got the exact requirement which we are looking for.Now we got the exact picture of what we need to do.
              Excellent. Being a proper developer you should now be capable to pick it up and implement it. Or at least be able to come up with a start.
              • 19. Re: Java questionaire app
                800839
                Thanks. This is the design i am looking at:-

                     public class Question (mapped to the Question table)
                     { 
                     private Integer questionId;
                     private Integer userId; // FK of User table
                     private String questionDesc;
                     private Integer answerId; // FK of Answer table
                     private List<Answer> answerDesc; // FK of Answer table
                     private String category ; // FK of Category table (Java,.NET, etc)
                     
                }

                public class Answer
                     { 
                     private Integer answerId;
                     private String answerDesc;
                     
                     
                     
                }


                Now here the Question object will hold the details of the answers as well.

                Hence for a particular User who has logged in based on this expertise in a particular category (Java, .net, etc) the questions and the answers will be displayed. Here the

                QuestionId  UserId    QuestioonDesc     AnswerId     AnswerDesc       Category
                100 200 What is JVM? 1 aaa,bbb,ccc,ddd Java


                For the above question option 1 is correct which is aaa. Whether the above is right? or is there any better way to design the tables? . please clarify. Thanks.
                • 20. Re: Java questionaire app
                  TPD-Opitz
                  After 400+ posts, isn't it time to learn how to put formatted code?
                  https://wikis.oracle.com/display/Forums/Forums+FAQ -----

                  You should have a marker in your Answer Table that indicates correct ones.
                  <tt>userId</tt> should not be part of the Question table unless each user gets it verry own set of questions.

                  And bye the risk of repeeting myself:
                  I'd crate another table that connects users, questions and the answer given by the user:
                  UserAnswer(
                    userId,
                    questionId,
                    answerId)
                  bye
                  TPD
                  • 21. Re: Java questionaire app
                    800839
                    Thanks TPD. Here the answerId will display the 4 objectives(that is the 4 answer options for the questions?) if not how we can map the multiple answers (in this case 4 for a question) and also mentioning the correct answer among the four in answer table? please clarify. Whether the multiple answers for the question should be separated by a comma as i shown in the previous example? Please clarify.
                    • 22. Re: Java questionaire app
                      TPD-Opitz
                      Before proceding I strongly recomment reading:
                      http://en.wikipedia.org/wiki/Relational_data_model
                      http://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model
                      http://stackoverflow.com/questions/1100819/how-do-you-design-object-oriented-projects

                      This is not the place to learn the basics.

                      bye
                      TPD
                      1 2 Previous Next