In this activity you will extend the quiz app from the previous activity to have multiple questions.
Modify the quiz app from the previous activity so that when the user gets a question correct, a new question is displayed. Create a separate function for each question to minimize the code in the main page. The app should have at least 3 questions.
To hide one question and display another, create a global variable for the current question number. Call the function that displays each question inside of an if statement that checks what the current question number is. When the user gets a question correct increase the value of the current question number variable.
When the user has answered the last question, hide the question and display the percentage of times the user clicked a correct answer. The text should be labeled so that the user understands what the number means. For example, it could display “You got 100% correct!”
To calculate the percent correct, divide the number of correct answers by the number of times the user clicked on a button. This will give a number between 0 and 1, to make it a percentage, multiply it by 100 and use the
math->round
function to remove the decimal places. Use the concatenate operator || to join the number with text that labels it.
Submission
Please show your source code and run your scripts for the instructor or lab assistant.