Tuesday:
The Matrix Quiz.
MatrixQuiz.zip (images, text file and exe)
Questions and answers taken from
http://www.triv.net/html/Users6/u15218.shtml
- Design a page that looks like the form shown above:
- I made a table with one row and two columns, and then made a table in each of
those cells -- the first with two rows and one column and the second with three
rows and one column
- On the left hand side, the top part is to display a question
- On the left hand side, the bottom part is to display four radiobuttons
and eventually the possible answers (which I had in span elements <span>I
am a span. </span>)
- On the right hand side, the top will hold an image
- On the right hand side, the middle will have two buttons, one to check answers, one to proceed to
the next question
- On the right hand side,the bottom will display the results
- In the page's onload method, parse the text found in MatrixQuiz2.txt based on the
delimiter |, place the result in an array (declared globally).
- Shuffle the lines so that they are in random order. We will proceed
through them one by one, thus we will need a counter (as in Art Slide Show).
- Load the first matrix image file into the picturebox.
- When the Next button (which initially says "Start Quiz") is clicked,
- Take the current line under consideration and parse it on a "/". The first token
is the question, the second token in the correct answer, and the third token is a
comma-separated string of possible answers.
- Parse the comma-separated string of possible answers on a comma to obtain
an array of possible answers, shuffle them, load them into the radiobuttons. (I placed them
in the spans next to the radiobuttons so the user could see them, and I assigned them to
the values of the radiobuttons so the coder could "see" them.)
- Make sure none of the radiobuttons are selected by setting their Checked
property to False.
- If it is not the first time the button is being clicked, display the number
of correct answers and the number of questions asked so far.
- Disable the Next button and Enable the Check button.
- If you are out of questions, then disable the Check button as well.
- Increment your counter and change the picture. There are more questions
than pictures, so the pictures have to be cycled around.
- When the Check button is clicked,
- Enable the next button and disable the check button.
- Compare the user's guess as indicated by the radiobuttons, to the correct
answer. If they match, display a "Correct" message. If they don't match, display an
"Incorrect" message and tell the user the correct answer.
- Keep track of the number of correct answers.