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
AlladinOne [14]
2 years ago
7

Write a complete Java program called Rooter that gets a positive integer called "start" from the user at the command line and th

en finds the squareroot of every number from "start" down to 0. Use a while loop to count down. Print each square root on a separate line. Include data validation to ensure the user provides a positive integer. Assume that the user enters an integer, and for validation, just check to be sure it is positive. If the validation is not passed, provide the user with suitable feedback and stay in the program to let the user try again until valid input is received. Use the Math.sqrt(double a) method to find each square root.
Computers and Technology
1 answer:
Nataly_w [17]2 years ago
4 0

Answer:

The program in Java is as follows:

import java.util.*;

import java.lang.Math;

public class Rooter{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

 int start;

 System.out.print("Start: ");

 start = input.nextInt();

 while(start<=0){

     System.out.print("Number must be positive\nStart: ");

     start = input.nextInt();  }

 while(start>=0){

     System.out.println(Math.sqrt(start));

     start--;  }

}

}

Explanation:

This declares start as integer

 int start;

This prompts the user for input

 System.out.print("Start: ");

This gets input for start

 start = input.nextInt();

The following is repeated until the user input is valid i.e. positive

<em>  while(start<=0){</em>

<em>      System.out.print("Number must be positive\nStart: ");</em>

<em>      start = input.nextInt();  }</em>

The following while loop prints the square root of each number till 0

<em>  while(start>=0){</em>

<em>      System.out.println(Math.sqrt(start));</em>

<em>      start--;  }</em>

You might be interested in
A bluetooth device in ____ mode is part of the piconet but is in a low-power state.
adelina 88 [10]
A bluetooth device in park/hold mode is part of the piconet but is in a low-power state. These are power saving modes of operation for Bluetooth devices which are connected to a piconet and  are used when no data is to be transmitted.The hold mode is used when connecting several piconets or managing a low-power device such as temperature sensor. When the park mode is used t<span>he device is still synchronized to the piconet but does not participate in traffic.</span>
7 0
3 years ago
The WAN connections to your regional offices are unfortunately extremely slow for your users and they are complaining about file
Zanzabum

Answer: (B) Branch cache

Explanation:

  The branch cache is the process of cache the data from the given file and the wen server on the wide area network. In the WAN connection, the branch code is the type of functionality which basically allow the window to providing the remote user support in the network. The branch cache basically work on the two mode that are:

  • The distributed mode
  • The host mode

The branch cache is the one of the technology that intend the cache data for reducing the network traffic in the wide are network.

Therefore, Option (B) is correct.

5 0
3 years ago
Ranges of IP address that anyone can use for their internal networks are known as ______.
Rama09 [41]
Since no answer choices, have to deduce it is Private Networks
8 0
3 years ago
Read 2 more answers
Who wants to be my tutor?
anzhelika [568]

Answer:

i would but im not big brain

Explanation:

8 0
3 years ago
Read 2 more answers
We use _____command to get data from the user? (python)
Genrish500 [490]

Answer:

INPUT

Explanation:

EXAMPLE PYTHON CODE

_______________________________________________________

INPUT CODE:

_______________________________________________________

foo = input('foo: ')#Have some text printed before the input field

bar = foo

print(bar)

_______________________________________________________

OUTPUT CODE:

_______________________________________________________

foo: Hello World!

Hello World!

>>> bar

'Hello World!'

>>>foo

'Hello World!'

5 0
3 years ago
Other questions:
  • What are the planes used to allow SDN to virtualize parts of the physical network so that it can be more quickly and easily reco
    6·1 answer
  • 15 POINTS COMPUTER LITERACY <br> The range A2:A4 has how many cells<br> -2<br> -4<br> -6<br> -8
    14·1 answer
  • Select the correct answer.
    6·1 answer
  • Mention 3 wast water draining system on home​
    7·1 answer
  • In codd's model of a relational database, data is stored in a(n) _____, which maintains information about a(
    7·1 answer
  • "_____ devices improve memory by encoding items in a special way."
    13·1 answer
  • Which types of scenarios would the NETWORKDAYS function help calculate? Check all that apply.
    7·1 answer
  • _____ provide a description of the data characteristics and the set of relationships that link the data found within the databas
    8·1 answer
  • 2. (8 points) When creating the Academic Database, there were several instances of data
    11·1 answer
  • You should move around and take a rest for 30 minutes every 5 minutes.<br><br>True Or False​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!