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
Attackers have recently launched several attacks against servers in your organization’s DMZ. You are tasked with identifying a s
kari74 [83]

Answer:

Option B is correct.

Explanation:

Well into the DMZ corporation of the user, intruders have currently conducted numerous attempts toward networks. He is associated with finding any response which would provide the greatest opportunity in the future to avoid such threats.  

The in-band IPS becomes the better approach for the required choices. Traffic moves via the IPS, as well as it has a better probability of avoiding inner processes through entering invasion.

4 0
2 years ago
What are some types of vehicle technology advancements?
julia-pushkina [17]

Answer:

D is the suitable answer.

Explanation:

All of the above

5 0
3 years ago
What is an undirected graph?
ella [17]

Answer: An undirected graph is the graph that has the connection of the objects in the form of bidirectional edges.This graph is formed for by the attachment of the collection of the objects which get displayed in the form of network and thus, also known as the undirected graph.

The graph is formed by the nodes or objects getting connected and form edges or link(which is typically in the form of line).

.

5 0
3 years ago
Which of formula contains an absolute cell reference?
svet-max [94.6K]
Which formula contains an absolute cell reference? =SUM($B$7:$B$9)
3 0
2 years ago
Que es un algoritmo informático?
nasty-shy [4]

Answer:

An algorithm is a specific procedure for solving a well-defined computational problem. ... It requires an understanding of the alternatives available for solving a computational problem, including the hardware, networking, programming language, and performance constraints that accompany any particular solution.

4 0
2 years ago
Read 2 more answers
Other questions:
  • In 3–5 sentences, describe the unique challenges e-mail presents for business communications.
    13·2 answers
  • Which is a benefit of peer-to-peer networking?
    10·1 answer
  • Which of the following is *not* true about logging user and program actions on a computer?
    10·1 answer
  • Which of the following is an example of tangible property?
    5·1 answer
  • Can I ask a computer question based on engineering?
    8·1 answer
  • What is the purpose of a report?
    14·1 answer
  • Guess The Song:
    9·1 answer
  • An alternative to configuring individual workstations is to establish configurations dynamically when the computers connect to t
    7·1 answer
  • When you create a user with the useradd command, what is the immediate state of it?
    6·1 answer
  • Retype the below code. Fix the indentation as necessary to make the program work.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!