import java.util.Scanner;
import java.lang.Math;
public class Main
{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int QUEST = 0; // accumulator of Questions
int mcq = 1; //counter of Questions
int answer; // answer for each question
int points = 0;
System.out.print("How many questions do you wanna answer? ");
QUEST = input.nextInt();
do{
System.out.println("Q#" + mcq + ")" + (int)(300*Math.random()+1) + " % " + (int)(7*Math.random()+2));
System.out.print("What is your answer: ");
answer = input.nextInt();
if(answer==(int)(300*Math.random()+1) % (int)(7*Math.random()+2)){
System.out.println("Correct!");
points++;
} else{
System.out.println("Wrong!");
}
mcq++;
} while(mcq<=QUEST);
}
}
question:
Filename: modTutorName
Create a program that prompts the user for a number of modulus math questions that they want to answer. The program will then quiz the player on that number of randomly generated questions of the style:
(random 1-300) % (random 2-7) = ?
For each question the user gets correct they earn a point. After ALL the questions have been asked, the program will display the number of correct answers as well as the percentage of correct answers.