Question: Java: please make sure program compiles before posting on here. Write a program that prompts the user for a value greater than 10.0 as an
Java: please make sure program compiles before posting on here.
Write a program that prompts the user for a value greater than 10.0 as an input and finds the square root of the number and the square root of the result, and continues to find the square root of the result until we reach a result that is smaller than 1.01
The program must:
produce the output as shown in the sample run below including the line number
must use do-while loop for the input and a while loop for the square root calculations.
Follow this algorithm:
with do-while loop keep prompting the user for input for as long as the given number is NOT greater than 10.0 (see example 6.13)
calculate the first square root of the given number (prime read)
with a while loop (see example 6.1):
increment the square roots counter
print the running count followed by the square root value
calculate the next square root (for example squareRoot = Math.sqrt(squareRoot);)
print the final results
The following is a sample run of the finished program:
> java SquareRoots Enter a number greater than 10.0 > 9
Enter a number greater than 10.0 > 10.5
1. Calculated square root is --> 3.24037034920393 2. Calculated square root is --> 1.8001028718392542 3. Calculated square root is --> 1.3416791240230483 4. Calculated square root is --> 1.1583087343290857 5. Calculated square root is --> 1.0762475246564267 6. Calculated square root is --> 1.0374235030383814 7. Calculated square root is --> 1.0185398877993839
For the input 10.5 the number of square roots greater or equal than 1.01 is 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
