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
A type of VPN connection, where a single computer logs into a remote network and becomes, for all intents and purposes, a member
elena-s [515]

Answer:

Client To Site.

Explanation:

The Client-to-Site is a virtual private network which used to provide the connection of the device like a laptop to the organization network. In the Client To Site a single computer is connected to the remotely network, for all the purpose and the intent of the network.

The single laptop is connected with a remote machine in the firewall. The  "IPSec" protocol is used in the Client To Site connection.

3 0
4 years ago
What is the name of the process that weighs the alternatives, gathers all necessary information, and can ultimately lead you to
blondinia [14]
This process is known as decision making.
8 0
3 years ago
Read 2 more answers
What important technology has done the most to allow small businesses a change to compete with larger international companies.
Natalka [10]

Answer:

If this is actually college then thats weird cuz im in middle school and im doing this stuff. And the answer is wireless networks

Explanation:

3 0
3 years ago
Difference between batabse and database management system
adelina 88 [10]

Answer:A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS). ... The data can then be easily accessed, managed, modified, updated, controlled, and organized.

Explanation:A database could be grades that students get at school and to manage it we can use a spreadsheet program like excel

4 0
3 years ago
Write Python statements that correspond to the actions below and execute them (a) Assign integer value 3 to variable a. (b) Assi
snow_tiger [21]

Here is code in Python.

#integer value 3 assigned to variable a.

a=3

#integer value 4 assigned to variable v.

b=4

# the value of given expression a * a b *b will be assign to variable c .

c=(a*a)*(b*b)

Explanation:

First an integer value is assigned to variable "a".And then integer 4 is assigned to variable "b". Calculate the value of expression a*ab*b and assigned to variable "c". Here expression a*ab*b can also be written as (a*a)*(b*b).

5 0
3 years ago
Other questions:
  • URGENT!! Which graphic design tools help you draw circles and rectangles?
    12·2 answers
  • Who are the founders of Microsoft?
    5·1 answer
  • Why do the holes at the top of parachutes make it go slower
    12·1 answer
  • Consider the following relationship involving two entities, students and classes:A student can take many classes. A class can be
    9·1 answer
  • What does px mean in css ?
    13·1 answer
  • For LG, on the app Messages, will the delete button on the upper right corner cancel a sending message?
    12·1 answer
  • Unlike oracle, access does not support the decimal data type.​<br><br> a. true<br><br> b. false
    9·1 answer
  • What is the full meaning of Internet and WiFi
    6·2 answers
  • *
    6·2 answers
  • What kind of charger can i use for this
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!