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
belka [17]
3 years ago
12

Write a program that produces the following output (where the user may enter any positive integer under 10):______

Computers and Technology
1 answer:
Mekhanik [1.2K]3 years ago
3 0

Answer:

// The Scanner class is imported to allow the program receive user input

import java.util.Scanner;

// The class is defined called Solution

public class Solution {

   // The main method is defined which begin program execution

   public static void main(String args[]) {

     // Scanner object 'scan' which receive user input from the keyboard

     Scanner scan = new Scanner(System.in);

     // the userInput variable is initially set to 1 (true) to allow the program continue prompting the user for input

     int userInput = 1;

     // while loop which continue execution as long as the userInput is greater than 0 and less than 10

     while (userInput > 0 && userInput < 10){

         // Prompts is displayed to the user to enter number below 10

         System.out.println("Enter a positive integer under 10:__________");

         // the next input is assigned to userInput

         userInput = scan.nextInt();

     }      

   }

}

Explanation:

The above code continue prompting the user to input an integer as long as the input is greater than 0 and less than 10.

You might be interested in
Which line in the following program will cause a compiler error? #include using namespace std; int main() { int number =5; if (n
DanielleElmas [232]

Answer:

  1. #include  <iostream>
  2. using namespace std;
  3. int main() {
  4. int number =5;
  5. if (number>=0&& number <=100){
  6.    cout<<"passed.\n";
  7. }
  8. else{
  9.    cout<<"failed.\n";
  10. }
  11. return 0;
  12. }

Explanation:

There where multiple errors in the code given in the questions

Line 1: Missing <iostream>

Line 5: The comparison operator was wrong correction is highlighted

Line 12 Missing closing brace for the main function

All the errors have been fixed and the code above compiles

4 0
2 years ago
A _____ is usually a smaller version of a data warehouse
Strike441 [17]
A ( micro ) is usually a smaller version of a data warehouse
4 0
2 years ago
What is a program that, when installed on a computer, records every keystroke and mouse click?
Mrac [35]
"Key logger" This could be software or hardware that does this.
6 0
3 years ago
A communication pattern in which the parties slowly reduce their dependence on one another, withdraw, and become less invested i
zepelin [54]

Answer:

The correct answer to the following question is option A. an avoidance spiral.

Explanation:

An avoidance spiral is a spiral in which parties avoid the conflicts at all cost in which leads to reducing the influence, dependence, etc. This spiral can also be destructive.

In other words, it is the only spiral in parties slowly reduces their dependence and the influence on the one and another.

7 0
3 years ago
Which tab in Microsoft Word provides access to the backstage view?
ivann1987 [24]
The answer is control windows
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following roles is responsible for writing programming code?
    10·1 answer
  • The following slide was created as part of a presentation that trains new employees how to use the scheduling and calendar softw
    14·2 answers
  • What is a slide master ?
    8·2 answers
  • For what purpose is keylogging software used? a. To automatically translate input to another language as the user enters data b.
    10·1 answer
  • To answer the research question "How am I going to find the information I need on the tople?" the best thing Georgia should
    15·1 answer
  • a marketing company is setting up a new office in the city. which type of contract should they sign for periodic maintenance of
    15·1 answer
  • Question 21 pts How many lines should an email signature be? Group of answer choices "5 to 6" "7 to 8" "1 to 2" "3 to 4"
    10·1 answer
  • How would you design an adaptive environment for people who are blind?
    10·1 answer
  • You have a technical interview for a new position in digital media. One of the questions you are asked is this: “A client asks y
    13·1 answer
  • 5. An external CSS file is saved with D. Answer the following questions. 1. Explain the purpose and advantages of using CSS.​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!