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]
3 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]3 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
Most network cards contain a port that accepts a(n) ____, which looks similar to a telephone connector but is larger.
Vadim26 [7]
YOUR ANSWER IS -------- It accepts a RJ-45 connector
hope i helped you :).
take care
8 0
4 years ago
You can create an arraylist using _________. a. new arraylist[] b. new arraylist[100] c. new arraylist&lt;&gt;() d. arraylist()
Tems11 [23]

new ArrayList<>()

ArrayList<data_type> list_name = new ArrayList<>(); The following statement, for instance, can be used to build a generic ArrayList of type String.

ArrayList<String> arraylist = new ArrayList<>(); This will produce a String-type empty ArrayList with the name "arraylist."

Learn more here:

brainly.com/question/16464645

#SPJ4

7 0
2 years ago
A man travel 200m towards east&lt;br /&gt;from his house then takes left&lt;br /&gt;to turn and moves 200 m north&lt;br /&gt;fin
11Alexandr11 [23.1K]
Using the Pythagorean theorem:

200^2 + 200^2 = x^2

x = 282.842712... from the original distance
4 0
4 years ago
The motion of any object can be broken down into it's component (parts of) vectors. true or false
Zepler [3.9K]

Answer:

The correct answer choice is true.

8 0
3 years ago
Read 2 more answers
To what are multiple servers arranged in racks related
qaws [65]

Various number of servers placed in racks are related to Rack servers in data center.

Explanation:

In data center commonly used server is Rack servers.  Servers are being arranged in the mounted racks are generally called as rack servers in the data center. Internal fans are being fitted inside the racks make the servers to make a good airflow and maintain the cooling. There are different types of racks available the user can choose based on their requirement.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Which is NOT a way the network operating sys-
    6·1 answer
  • What government agency initially began the work with computers that would eventually lead to the development of the Internet?
    5·2 answers
  • What are 5 ways we can reduce our energy?
    5·1 answer
  • 2. Why don't all buses on a motherboard operate at the same speed?​
    6·1 answer
  • A) Suppose a computer has an instruction pipeline with 4 phases. How many cycles (if there are no delays) would it take to compl
    13·1 answer
  • Many websites (mostly online shopping sites), monitor a person’s Internet browsing behavior, such as the websites we often visit
    14·1 answer
  • 3. Compilers and Assemblers translate each source file individually to generate object code files. Hence the object files need t
    13·1 answer
  • A digital presence created online by an individual or organization using a digital device is called a identity.
    7·1 answer
  • Final one bit l y links are a virus that will corrupt your files do not go on it
    15·2 answers
  • Write the necessary preprocessor directive to enable the use of the stream manipulators like setw and setprecision Additional No
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!