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
While working on a group project, you notice something does not look right in the presentation. You call a meeting with your tea
alexgriva [62]

Answer:

Teamwork

Explanation:

4 0
4 years ago
Which term best describes the operating system of a computer
ololo11 [35]

Answer: System Software

Explanation:

7 0
3 years ago
Can someone please help me answer this I can’t fail. tysm :)
vredina [299]

Answer:

  1. option d <em><u>b</u></em><em><u>e</u></em><em><u>c</u></em><em><u>a</u></em><em><u>u</u></em><em><u>s</u></em><em><u>e</u></em><em><u> </u></em><em><u>o</u></em><em><u>f</u></em><em><u> </u></em><em><u>y</u></em><em><u>o</u></em><em><u>u</u></em><em><u>. </u></em><em><u> </u></em><em><u> </u></em><em><u>b</u></em><em><u>l</u></em><em><u>a</u></em><em><u>a</u></em>

Explanation:

whu

5 0
3 years ago
For each problem listed below, use the drop-down menu to select the field of the professional who can help solve the issue.
Paul [167]

Answer:

  • Interactive media
  • Information services and support
  • Programming and software development
  • Network systems administration

Explanation:

The company has finished designing a software program, but users aren’t sure how to use it. <u>interactive media</u>

Several people in the human resources department need new software installed. <u>information services and support</u>

An employee has an idea for a software program that can save the company time, but doesn’t know how to write it. <u> programming and software development</u>

A new branch of the company is opening soon, and the computers there need to be connected to the Internet. <u>network systems administration</u>

<u>OAmalOHopeO</u>

3 0
3 years ago
Which of the following is probably not a place where it is legal to download the music of a popular artist whose CDs are sold in
nignag [31]

Answer:

A. Personal blogs

Explanation:

I did the quick check, and there you go...it's A.

5 0
3 years ago
Other questions:
  • On the UB-04 claim form, the type of bill is identified by a four-digit numerical code. The first digit is a leading zero, what
    10·1 answer
  • Which option can Jesse use to customize her company’s logo, name, address, and similar details in all her business documents?
    6·1 answer
  • To calculate subtotal for a table, the first step is to use the ____ button on the table tools design tab.
    15·1 answer
  • What do you understand by Multiprotocol Label Switching, how it works and is helpful in today's network scenario.
    15·1 answer
  • Assignment 1: silly sentences edhesive
    7·1 answer
  • A small company with 100 computers has hired you to install a local area network. All of the users perform functions like email,
    9·1 answer
  • Timmy walks into a store to buy a PC game. He reads this information about a game on its packaging:
    7·1 answer
  • How to start the ms excel​
    10·1 answer
  • SOMEONE PLEASE HELP!! i’ll give brainliest
    14·2 answers
  • Python Question Class 11 attached below
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!