Home > Default > Need idea on how to do question and answer program

Need idea on how to do question and answer program

November 30Hits:0
I want to create a troubleshooting program where it asks the user questions until its drilled down to an appropriate answer.
I've done this with a web server before but I can't seem to figure out how to do it in a program without involving many many forms. Any ideas on how to do the UI?


Building an expert system is not a trivial process so for a commercial app you'll need to do some research. For an internal app you should probably use a database. For a school project you can get away with storing the data in a file that is loaded into
memory (or simply building the data in memory directly).  In any case you'll need to define a table of questions.  If you support questions with fixed answers then you'll need a separate table for the answers associated with the questions. 
If questions can be different types (as mentioned previously) then you'll also need to track the question type with the question.  For the relationship between questions you can go different ways depending upon your requirements. If question 1 with answer
A goes to question 2 but answer B goes to question 3 then you can create a simple reference table that indicates what the next question is given the current question and answer, basically a state machine.  If a single answer opens a whole series of questions
then you might do better to group the questions together and manage the transition between groups of questions.  It really depends upon your requirements. You'll want to research state machines to implement this though.
On the UI side you really don't need to dynamically create anything.  The only thing that changes between questions is the text and possibly the answer format (if you support multiple questions). As I mentioned earlier you can create a separate container
(Panel) for each question type and then show or hide the container based upon the type of question (from your database data).  This eliminates the need to dynamically create the UI.

Read other 9 answers


Related Articles

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.669 s.