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
Small data files that are deposited on a user's hard disk when they visit a website are called _______.
IrinaK [193]
The answer is cookies
7 0
3 years ago
Read 2 more answers
How to manufacture an ict application?
Vilka [71]
Go to here (Applications in Manufacturing - Free ICT Resources)
3 0
4 years ago
Please help with my Python code - Functions
valentinak56 [21]

Answer:

Explanation:

see attached for help

4 0
3 years ago
You are writing a program using the Java language. Which of the following is a requirement of Java syntax?
miv72 [106K]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

"D" option is correct

           "Each statement needs to end in a semicolon."

semicolon must use in program.without semicolon program doesn't accept.so each statement needs to end in a semicolon.

4 0
3 years ago
A customer has contacted you to help him alleviate the large amount of time and effort that goes into adding and removing users
Ostrovityanka [42]

Answer: On-demand

Explanation:

On-demand computing is the term of cloud computing that describes the function that provides organization with cloud hosting services. This function permits those organization to provide their customers for assessing computing resources and services as per necessity.

According to the question,on-demand is the computing function that should be used in the mentioned case. Technician and customers will get to access the computer as per their necessity and will not have to waste their efforts and time.

7 0
4 years ago
Other questions:
  • In printing systems using ____, a disk accepts output from several users and acts as a temporary storage area for all output unt
    14·1 answer
  • A new company will have 40 workstations in one building sharing a single network. All users must be able to share files and prin
    9·1 answer
  • Your customer asks you if it would be worth the investment for him to have Ethernet cabling installed to reach each of his works
    6·1 answer
  • Imagine you are building an ATM system; list at least 6 application domains for the system. That is, in which context is the sys
    13·1 answer
  • Many Web browsers allow users to open anonymous windows. During a browsing session in an anonymous window, the browser does not
    14·1 answer
  • A friend was just promoted to a new job that requires part-time travel, and he has also been promised a new laptop after his fir
    10·1 answer
  • Which of the following pieces of evidence was NOT used to support the Theory of Continental Drift?
    10·1 answer
  • Write a program that repeatedly reads in integers until a negative integer is read. The program keeps track of the largest integ
    9·1 answer
  • After inserting a video into your slide how can you test it
    11·1 answer
  • Usually it is a rectangular box placeed or underneath your desk​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!