Agility Katas “Filling Out a Questionnaire I”
Write an application to fill out a questionnaire. The user is presented with a multi-question questionnaire. She answers each question by clicking an option. After having answered all questions she can view her score.
Each question can have one or more options. An additional option always is “Don´t know”. Only one option is the answer to the question.
The score shows how many (e.g. “9 out of 10 questions (90%)”) and which answers (including option chosen as well as correct option) were given correctly by the user.
Here´s a sketch of how a graphical frontend for the application might look:
The questionnaire is loaded from a simple text file named questionnaire.txt (located in the application directory) looking like this:
?Which of these animals is a mammal
?What is the sum of 2+3
All entries are single line. Questions start with a “?”, lines following a question are considered answer options. The answer option starting with a “*” is the correct answer.