Question: Java: The following program is designed to implement a simple multiplication quiz. The program generates random numbers in a specified range and prompts the user

Java:

The following program is designed to implement a simple multiplication quiz. The program generates random numbers in a specified range and prompts the user to enter the product of those numbers. Read the program to become familiar with it and also compile and run it.

import java.util.Scanner; public class MultiplicationQuiz { public static void main( String [] args ) { // Generate 2 random numbers that will be multiplied int number1 = (int) ( Math.random() * 10 ); int number2 = (int) ( Math.random() * 10 );

// Prompt user to input answer System.out.print( "What is " + number1 + " * " + number2 + "? " ); Scanner input = new Scanner( System.in ); int answer = input.nextInt();

// Grade the answer if ( ( number1 * number2 ) == answer ) System.out.println( "Congratulations...you are correct!" ); } }

Modify the program so that it also performs the following:

It should prompt the user to enter how many multiplication problems to generate

If the user enters a wrong answer, the program shall display what the correct answer is

It should display the users score as a percentage of problems the user answered correctly

It should display the total amount of time, in seconds, that the user took to complete the quiz

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!