tial
ize
they are in itialized (set to
False
be cause none of the
questions have been an swered yet):
q1Answered = False
q2Answered = False
Remember that if you have more questions, you need to re peat both of these sets
of statements for each additional variable.
Next, we need our specialized
RightAnswer
and
WrongAnswer
pro ce-
dures.
RightAnswer1
is tied to the right answer but
ton for question 1.
WrongAnswer1
is tied to the wrong answer but
ton(s) for question 1.
RightAnswer2
and
WrongAnswer2
are for question 2. And, if we had more
ques tions,
RightAnswer3
and
WrongAnswer3
would be for question 3;
RightAnswer4
and
WrongAnswer4
would be for question 4; etc.
These pro cedures simply check the ap propriate vari able to see if the ques-
tion has been answered. If it hasn’t (
If q1Answered = False Then
), we up -
date the score (
numCorrect = numCorrect + 1
or
numIncorrect =
numIncorrect + 1
). Regardless of whether or not it has been an swered be-
fore, we set the variable to
True
(e.g.,
q1Answered = True
for question 1) and
give the ap pro pri ate feed back (call ing
DoingWell
or
DoingPoorly
).
Short-Answer Quiz Questions
The above examples can be ex tended very easily to in clude short-answer ques-
tions. If we were to add a third ques tion that was short an swer, we would first need
the variable
q3Answered
, just like
q1Answered
and
q2Answered
, de clared with
a
Dim
state ment and in itialized in the
Do'stlaringiz bilan baham: |