The following method was known to the ancient Greeks for computing square roots.
ID: 3683712 • Letter: T
Question
The following method was known to the ancient Greeks for computing square roots. Given a value x > 0, and a guess g for the square root, a better guess is (g + x/g)/2. Write a recursive helper method public static squareRootGuess(double x, double g). If g2 is approximately equal to x (that is, less than .0001 difference between x and g), return g, otherwise, return squareRootGuess with the better guess. Then write a method public static squareRoot(double x) that uses the helper method.
You do not need a screen-shot of this lab.
Here is a sample run from a working project:
Enter a number: 27
The square root is of 27.000 is 5.19615
Expected value: 5.19615