Lesson 8 Quiz App
Objectives
– Create a quiz app
– Learn how to use options with Radio Button
– Analyze the user answer in C#
You will create a quiz app with at least 10 questions.
Radio Button
The tag used to select an answer is called
There are 2 important properties:
– Content: similar to Text, but only for
– GroupName: All the answers from 1 question belong to the same GroupName
Radio Button
Each answer needs a
You can have as many answer as you need, with a minimum of 2.
You also need to give each answer a name with the property
Note: Set the first answer of each question as IsChecked=¡°True¡±
浙大学霸代写 加微信 cstutorcs
When you click on the
Result The result is displayed inside a
Result – Answer The result is displayed inside a
程序代写 CS代考 加QQ: 749389476
Analyze of the answers
When the user click on the
Analyze of the answers Everything will be done inside the function ¡°Button_Clicked¡±.
First of all, create your variable ¡°score¡±. Remember that you can have more than 1 variable ¡°score¡± depending on your quiz.
Analyze of the answers
You can access to the property ¡°IsChecked¡± using each
You will create an ¡°if conditional¡± for each answer. If the answer is checked (IsChecked == True), then the user chose that answer.
Analyze of the answers
Then you simply need to add or remove points according to the user answer. For example, in this example, if the user choose the answer 1 for question 1, he will get 1 point. If the user choose the answer 2 for question 1, he will lose 3 points.
You need to do this for every question and every answer.
Analyze of the answers
After calculating the score, you need to show the result accordingly. Simply compare the score with an ¡°if conditional¡±.
Note: If you have different ¡°score¡± variables, you need to compare them to find the highest one.
Code Help
Analyze of the answers Last step: we need to show the result to the user.
You have created a
Just update all your ¡°if conditional¡± with different Text. Note: You can update any property like this.