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
Which website citation is correctly formatted according to MLA standards?
inysia [295]

Answer:

<em><u>The</u></em><em><u> </u></em><em><u>answer</u></em><em><u> </u></em><em><u>is</u></em><em><u> </u></em><em><u>C</u></em><em><u> </u></em><em><u>no</u></em>

Explanation:

<em><u>Hope</u></em><em><u> </u></em><em><u>it</u></em><em><u> </u></em><em><u>will</u></em><em><u> </u></em><em><u>help</u></em><em><u> </u></em><em><u>you</u></em><em><u> </u></em><em><u>dear</u></em><em><u> </u></em><em><u /></em>

7 0
1 year ago
Read 2 more answers
What happens when you print a document with red, green, and blue underline?
Olegator [25]
They will not show up on pages

8 0
2 years ago
Read 2 more answers
Jana works in a call center helping people who are having trouble setting up their
olchik [2.2K]

Answer:

Information Support and Services

Explanation:

She works helping people setting up their accounts so she supports with information from her services

4 0
2 years ago
Read 2 more answers
Write a program that computes and displays a 15 percent tip when the
Anuta_ua [19.1K]
Your question wasn't very clear, but I think I understand what you want. Additionally, you should really state what language you're working with. Here it is in C#, and shouldn't be too much of a hassle to translate in to other languages.


Console.Write("Enter payment: ");

float payment;

if (float.TryParse(Console.ReadLine(), out payment))
    Console.WriteLine((Math.Floor(payment * 100) / 100) * 0.15, + " at 15% tip.");
else
    Console.WriteLine("Invalid input.");
5 0
3 years ago
Two electronics technicians are looking at the piece of testing equipment shown in the figure above. Technician A says that this
Ilya [14]
B is your correct answer.
8 0
3 years ago
Read 2 more answers
Other questions:
  • The largest country in South America
    7·1 answer
  • Im being timed please help!!
    7·2 answers
  • HELPPPP!!
    8·2 answers
  • Before his job interview, Shabnam took the time to carefully wash and iron his best khaki pants and a button-down shirt. He even
    15·2 answers
  • Technology can cause a drop in input costs.<br> a. True<br> b. False
    6·2 answers
  • Why is it important to be part of a team in times you fail and in times you succeed?​
    15·1 answer
  • Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which a
    8·1 answer
  • Need the answer ASAP!!!!!!!!!!!!! I’ll mark brainliest if correct
    8·1 answer
  • How do you fix this!!!!
    5·1 answer
  • Type of Factor Beginning Frog Count Simulation 1 (Low) Simulation 2 (High)
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!