Apr-02-2020, 11:09 AM
My approach -
Define an Answer class, with the text of the answer, text to be displayed if chosen, flag as to whether this is the right or wrong answer, and flag as to whether this answer was chosen.
Define a Question class, containing the text of the question and containing 4 Answer class items
Instantiate and populate the 40 Answer items and 10 Question items.
Loop through, displaying each question and the text of each answer, asking user to respond. Do validity checks on the responses (if 1-4 don't allow 5 or Moose as responses). Flag the chosen Answer items
When complete, loop through again. If the chosen Answer item is correct, move on. If not, display the response text. During this loop (the grading loop) you can also keep a count of right and wrong answers and give a percent at the end.
Define an Answer class, with the text of the answer, text to be displayed if chosen, flag as to whether this is the right or wrong answer, and flag as to whether this answer was chosen.
Define a Question class, containing the text of the question and containing 4 Answer class items
Instantiate and populate the 40 Answer items and 10 Question items.
Loop through, displaying each question and the text of each answer, asking user to respond. Do validity checks on the responses (if 1-4 don't allow 5 or Moose as responses). Flag the chosen Answer items
When complete, loop through again. If the chosen Answer item is correct, move on. If not, display the response text. During this loop (the grading loop) you can also keep a count of right and wrong answers and give a percent at the end.