Question
Your goal is to generate a simple math quiz with a number of equations that will be determined by the user. You will prompt the
Your goal is to generate a simple math quiz with a number of equations that will be determined by the user. You will prompt the user for an answer to each equation and display whether they answered it correctly or incorrectly. At the end of the math quiz, you will display the number of total equations that they answered correct out of how many were given.
Prompt the user for the number of math equations they would like to solve. You can use Scanner or JOptionPane.
Validate that the number of math equations entered by the user is 0 or greater.
Use a loop to generate the number of math equations that the user specified.
You will need to generate 2 random numbers from 1-50 for each equation. Then use addition as your operator.
Display an equation that adds the 2 random numbers together and prompts the user for an answer to the equation. You can use Scanner or JOptionPane.
Use conditionals to determine if the user is correct or incorrect and display a message that lets them know whether it was correct or incorrect.
Use a tally variable to keep track of how many questions they answer correctly.
Display how many questions were answered correctly out of how many questions were given. Figure out the percentage of questions that the user entered correctly and display this percentage. Note: you need to be careful of integer division when you are calculating the average. The variable that determines the total number of questions or the variable tallying the number of correct questions needs to be a double data type.
Based on the percentage of questions that were answer correctly, determine a message to display that will tell the user if they passed (percentage 70% or higher) or failed (percentage below 70%). If the user fails, loop the quiz to have them take it again.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started