Assignment
"Create a math quiz for a 6th
grade class. Use hidden fields for
the answers to the quiz. Use "Score
Quiz" for the label of the submit
button. When students click the submit
button, execute the onSubmit event
handler and determine if they have
answered all of the questions. If
they have answered all of the questions,
score the quiz using the onSubmit
event and use an alert dialog box
to instruct them to answer all of
the questions before selecting the
"Score Quiz" button. Save
the HTML document as MathQuiz.html."
(p. 169 of book)
Instructor's modification:
"Feel free to improve on his
assignment (which seems a bit lame
in my opinion)."
Student's modification: The
heck with the 6th grade It's
been 40 years since I was in 6th grade
and I don't have kids, so what do
I know about what's at that level?
<grin> I'm going to use college-level
set theory instead. (It's much more
interesting anyhow.)
This assignment has six explicit
requirements, and yields seven derived
requirements.
Requirements
Explicit requirements:
- The Math Quiz shall test students'
math in the area of undergraduate-level
set theory.
- The Math Quiz shall use hidden
fields for the answers to the quiz.
- The Math Quiz shall use "Score
Quiz" as the label of the submit
button. (Note: I always
use something other than "submit"
as the label of the "submit"
button; "submit" is too
computer-centric, and I use labels
that reflect the user's goal. I
did this in Individual Project 6,
for example.)
- The submit button shall invoke
the onSubmit event handler.
- The Math Quiz shall score the
quiz if and only if all of the questions
have been answered. If any of the
questions remain unanswered, the
function shall use an alert dialog
box and shall instruct them to answer
all questions before selecting the
"Score Quiz" button.
- The Math Quiz shall be stored
in a file named MathQuiz.html.
Derived requirements:
- The Math Quiz shall compare the
user's answers with the correct
answers.
- The Math Quiz shall keep track
of the number of questions answered.
- The Math Quiz shall inform the
user of the score achieved when
the quiz is scored.
- The Math Quiz should blank out
all previous answers when the page
is reloaded.
(Note: I couldn't get it
to do this, and would appreciate
some pointers.)
- Whenever the user changes an answer,
the MathQuiz shall mark the quiz
as "not scored".
- The MathQuiz shall retain previous
answers after the quiz is scored.
(reason: Allow the user to change
an answer without having to answer
all questions again.)
- After the user has answered all
the questions and scored the quiz,
the Math Quiz shall provide the
opportunity to see the correct answers.
(Note: I tried to use styles
to make this link visible [regular
color] and invisible [same color
as background], but I couldn't get
that to work. I'd appreciate some
suggestions.)
This second set are really more design
decisions and software requirements
than they are requirements at the
product level, but they are things
I identified as necessary for the
Math Quiz to work correctly and be
usable.
Documentation of Product
Description
This product is a five-item quiz
of college-level set theory. Four
items are multiple-choice, from which
the student must select one answer.
The other item (question 3) asks the
student to select two or more choices
that match.
When all five questions have been
answered, the student may click the
"Score Quiz" button to determine
the score. The "Start Over"
button may be clicked at any time,
to blank out all items and begin the
quiz anew.
Immediately after the quiz has been
scored, and before any answer has
been changed, the student may use
the link to see the correct answers.
Software Design
| Initialize: Mark
all questions as unanswered; mark
the quiz as "not scored". |
| When a radio button
is clicked (questions 1, 2, 4,
and 5), |
| |
Mark its question
as answered. |
| |
Mark the quiz as
"not scored". |
| When a check box
is clicked (question 3), |
| |
If at least two
check boxes are checked, mark
Q3 as answered. |
| |
If fewer than two
check boxes are checked, mark
Q3 as unanswered. |
| |
Mark the quiz as
"not scored". |
| When the Submit
("Score Quiz") button
is clicked, |
| |
Count the number
of questions answered. |
| |
If all questions
are answered, |
| |
|
Mark the quiz as "scored". |
| |
|
Count the number of user's answers
that agree with the correct answers. |
| |
|
Display the score in the "score"
field. |
| |
|
If the score is 5, display the
"perfect score" alert
box. |
| |
If not all questions
are answered, |
| |
|
Prepare a message saying that
the student must answer all questions
before clicking "Score Quiz". |
| |
|
If fewer than two choices have
been marked for Question 3, append
that info to the message. |
| |
|
Display the message in an alert
box. |
| When the Reset ("Start
Over") button is clicked, |
| |
Mark all questions
as unanswered. |
| |
Blank out all answers. |
| |
Mark the quiz as
"not scored". |
| When the link to
the correct answers is clicked, |
| |
If the quiz is "scored",
open the QuizAnswers window. |
Lessons Learned
TBD
|