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
Hello everyone can help me give all the answer​
krek1111 [17]

Answer:

1. were

2. were

3 was

4 was

5 were

1 wasnt

2 werent

3werent

4 wasnt

5 werent

were you at work?

was it in the garden?

were they worried?

was lucy present?

were his friends late?

1 they were

2 it was

3 he wasn't

4 I was

5 they weren't

Explanation:

7 0
2 years ago
Hardware failure, power outages, and DOS attacks will affect:
const2013 [10]

Answer:

The answer should be data availability

6 0
2 years ago
Write a regular expression pattern that matches strings representing trains. A single letter stands for each kind of car in a tr
MAVERICK [17]

Answer:

See explaination

Explanation:

import re

def isValidTrain(train):

pattern = r'^E+(((P|PP|PPP|PPPP)D)*(BB)*)*C$'

if re.match(pattern, train):

return True

return False

def checkAndPrintTrain(train):

print("Train", train, "is valid:", isValidTrain(train))

checkAndPrintTrain("EC")

checkAndPrintTrain("EEEPPDBBPDBBBBC")

checkAndPrintTrain("EEBB")

checkAndPrintTrain("EBBBC")

checkAndPrintTrain("EEPPPPPPDBBC")

checkAndPrintTrain("EEPPBBC")

checkAndPrintTrain("EEBBDC")

Sample output

Train EC is valid: True

Train EEEPPDBBPDBBBBC is valid: True

Train EEBB is valid: False

Train EBBBC is valid: False

Train EEPPPPPPDBBC is valid: False

Train EEPPBBC is valid: False

Train EEBBDC is valid: False

6 0
3 years ago
Which of the following statements does not explain the difference between safety stock
ioda

The statements does not explain the difference is that Cross-docking reduces inventory and storage space requirements, but handling costs and lead times tend to increase.

<h3>What is the difference between safety stock inventory and the cross-docking method?</h3>

safety stock inventory is known to be a kind of traditional warehousing systems that needs  a distributor to have stocks of product already at hand to ship to their customers.

But  a cross-docking system is one that is based on using the new and best input such as technology and business systems to produce a JIT (just-in-time) shipping method.

Learn more about safety stock Inventory from

brainly.com/question/18914985

6 0
2 years ago
Random stuff and pls don't report this thank you :D
skad [1K]

Answer:

hmmm....nice colors....what is it for?

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • (b) An online game allows players to race cars. They can play against other people or computer players.
    10·1 answer
  • Because health and safety are important in all workplaces, not just hazardous ones, what working conditions must ALL employers p
    10·2 answers
  • Wice each lunar month, all year long, these tides occur. Whenever the Moon, Earth and Sun are aligned, the gravitational pull of
    5·1 answer
  • What are scientists going to explore next on Kepler-186f? A) evidence of the existence of life B) types of plant life that exist
    8·2 answers
  • Which questions should you ask yourself when performing research online?
    9·1 answer
  • What is the basic purpose of the International Space Station that will be completed in 2010?
    11·1 answer
  • Write a Java program that creates a two-dimensional array of type integer of size x by y (x and y must be entered by the user).
    7·1 answer
  • Why does a print document need a higher raster effect setting ?​
    14·1 answer
  • WHICH PROGRAMMING LANGUAGES ARE THE BEST FOR PROGRAMMING?
    14·1 answer
  • When a ____________ file is opened, it appears full-screen, in slideshow mode, rather than in edit mode.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!