1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Serhud [2]
3 years ago
13

Write a program that deliberately contains an endless or infinite while loop. The loop should generate multiplication questions

with single digit random integers. Users can answer the questions and get immediate feedback. After each question, the user should be able to stop the questions and get an overall result. See Example Output.
Computers and Technology
1 answer:
Westkost [7]3 years ago
3 0

Answer:

The Java code is given below with appropriate variable names for better understanding

Explanation:

import java.util.Random;

import java.util.Scanner;

public class MultiplicationQuestions {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       Random rand = new Random();

       int n1, n2, result, total = 0, correct = 0;

       char ch = 'y';

       while(ch == 'y'){

           n1 = 1 + rand.nextInt(9);

           n2 = 1 + rand.nextInt(9);

           System.out.print("What is "+n1+" * "+n2+" ? ");

           result = scan.nextInt();

           if(result==n1*n2){

               System.out.println("Correct. Nice work!");

               correct++;

           }

           else{

               System.out.println("Incorrect. The product is "+(n1*n2));

           }

           System.out.print("Want more questions y or n ? ");

           ch = scan.next().charAt(0);

           total++;

       }

       System.out.println("You scored "+correct+" out of "+total);

   }

}

You might be interested in
How would you define media literacy?
Svetradugi [14.3K]
Mrs.Hinely grows roses there are 6roses on each of her 10rose bushes how many roses in all are on Mrs.Hinely's rose bushes
4 0
3 years ago
file Assume that a prototype of the part above was built from several cubes. The total volume of the part is 0.54675 in.3. What
Rina8888 [55]
The correct answer is D
5 0
3 years ago
How do you know if something is in the public domain
liraira [26]
You can start by looking at the date. Anything made before 1923, no matter what, will be definitely in the public domain. ... Most times, it's impossible to determine whether something is in the public domain just by the date. There are three ways you can find out definitively whether a work is in the public domain.
8 0
3 years ago
What is the meaning of the word joystick
Roman55 [17]
<span>The meaning of Joystick is the control column of an aircraft</span>
4 0
3 years ago
Read 2 more answers
How does light move? Shift? Bounce between different objects?
ZanzabumX [31]

Answer:

Bounce between different objects

Explanation:

Light probably will bounce off of objects or it might go through, i think it depends on what object and what material.

6 0
3 years ago
Other questions:
  • What type of data visual would you use to illustrate trends over time? Gantt chart Bar graph Line chart Scatter diagrams
    5·1 answer
  • What item on a business card is generally the most prominent?
    13·2 answers
  • Pls help! ive been looking everywhere online but I couldn't find the answer to this:
    5·1 answer
  • 3. The invention of the transistor was important to the development of computers because it
    5·1 answer
  • Do the shape of a sign gives you a clue about the information contained on the sign
    7·1 answer
  • Which type of computer is the best? laptop, tablet, or desktop
    15·2 answers
  • Which of the following is true about radio waves? They have short wavelengths. They have high energies. They reveal hot gases. T
    10·2 answers
  • As u type where does excel display the entry
    10·1 answer
  • Transborder data flow (TDF) restricts the type of data that can be captured and transmitted in foreign countries. True or False
    12·1 answer
  • View One | View All
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!