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
babymother [125]
3 years ago
14

Write an expression that executes the loop while the user enters a number greater than or equal to 0.Note: These activities may

test code with different test values. This activity will perform three tests, with userNum initially 9 and user input of 5, 2, -1, then with userNum initially 0 and user input of -17, then with userNum initially -1. See "How to Use zyBooks". .Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message.
Computers and Technology
1 answer:
Lena [83]3 years ago
5 0

Answer:

       do {

           System.out.println("Enter a number");

           userNum = in.nextInt();

           System.out.println("You entered "+userNum+" you are still in the loop");

       }while(userNum>=0);

Explanation:

  • In this solution in Java programming language a do.....while loop has been used to implement it
  • The condition while(userNum>=0); ensures that the user will continuously be prompted to enter a number as long as the number entered is greater or equals to 0.
  • See a complete program below That uses the scanner class and countinually prompts the user for input as long as the number entered is greater or equal to zero
  • The loop breaks once a number less than zero is entered by the user

<em>import java.util.Scanner;</em>

<em>public class num3 {</em>

<em>    public static void main(String[] args) {</em>

<em>        Scanner in = new Scanner(System.in);</em>

<em>        int userNum;</em>

<em>        do {</em>

<em>            System.out.println("Enter a number");</em>

<em>            userNum = in.nextInt();</em>

<em>            System.out.println("You entered "+userNum+" you are still in the loop");</em>

<em>        }while(userNum>=0);</em>

<em>        System.out.println("You are out of the loop now.... goodbye");</em>

<em>    }</em>

<em>}</em>

You might be interested in
You have an application running on multiple ec2 instances, however every time an instance fails, your users complain that they l
Alik [6]

To control the users from complaining that they lose their session when an application executes on multiple ec2 instances, store session state in Elastic ache.

<h3>What is an Elastic Cache?</h3>
  • AWS fully manages the in-memory data store and cache service known as Elastic Ache (AWS).
  • In-memory data storage that is compatible with open-source software may be easily set up, managed, and expanded in the cloud, according to Amazon.
  • The service improves the performance of web applications by utilizing managed in-memory caches rather to just slower disk-based databases.
  • Elastic ache supports the open-source in-memory caching engines Memcached and Redis (also known as "Elastic ache for Redis").
  • To control the users from complaining that they lose their session when an application executes on
  • multiple ec2 instances
  • , store session state in
  • Elastic ache
  • .

To learn more about Elastic ache refer to:

brainly.com/question/28209824

#SPJ4

8 0
2 years ago
Creating Classes
Ostrovityanka [42]

Answer:

fttfuuuuggffuu8ii

Explanation:

yyyuyuuuuuu

4 0
3 years ago
Why isn't there a Psychology section on this app?
lukranit [14]
I don't know to be honest.

3 0
4 years ago
write the implementation (.cpp file) of the gastank class of the previous exercise. the full specifiction of the class is:
o-na [289]

Answer: (no specifications)

Explanation:

Given that there is nothing listed about the class there would be no specifications for the class. This part of the question will not provide you with enough information to write code.

4 0
3 years ago
_____ is an effort by an employee to attract attention to a negligent, illegal, unethical, abusive, or dangerous act by a compan
AVprozaik [17]

Answer:

The answer is "whistle-blowing".

Explanation:

Whistleblowing is the organization's disclosure Part of the illegal immoral or existing. Unauthorized actions under the administrative influence. In this the workers, people or organizations operate to perform.

  • The main objective of this initiative is to eliminate non-ethical organizational behavior.  
  • It provides integrity or by being truthful throughout all times, doing all the correct thing is a key element of professional morality and conduct.
4 0
3 years ago
Other questions:
  • A construction company has an online system that tracks all of the status and progress of their projects. The system is hosted i
    10·1 answer
  • Which describes how media and networks interact
    12·1 answer
  • What does it mean to empty the cache?
    6·1 answer
  • Instructions:Select the correct answer.
    5·1 answer
  • What is the correct html element for playing audio files?
    11·1 answer
  • Which part of the Word application window should the user go to for the following activities?
    14·1 answer
  • Which of the following statements is TRUE of business intelligence (BI) systems? Business intelligence systems are primarily use
    7·1 answer
  • Which data type is –7?<br><br> int<br><br> single<br><br> string<br><br> float
    15·1 answer
  • With what software tool can you see the applications that are currently runni
    13·1 answer
  • What type of dns servers field dns queries, send iterative queries to upstream dns servers, or send requests to forwarders and t
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!