For this challenge we will create a maths quiz consisting of ten arithmetic questions. Each question will be randomly generated using two random operands between 1 and 12 and one random operator, either + (addition), – (subtraction) or x (multiplication). We will not include the division operator as this could result in a decimal value.

We will include a scoring system to our quiz. The player will be asked one question at a time and score 10 points per correct answer and lose 5 points per incorrect answer.

#### Complete the code

We have started with just a few lines to generate a random question.

Your task is to add some code to:

- Calculate the correct answer,
- Compare the user answer with the correct answer to see if the user is correct or not,
- Add 10 points for a correct answer or subtract 5 points for an incorrect answer,
- Use a loop to repeat this code 10 times,
- Display the final score, out of 100.

#### Extension Task

Why not add a leaderboard to your quiz. This would be used to store the player’s scores and display the top ten scores on screen, in descending order.

#### Solution...

The solution for this challenge is available to full members!Find out how to become a member:

➤ Members Area