Reference no: EM132217484
Written in java
Suppose you want to find the square root of x, guess that the square root is x/2. Test your guess (what's the difference between x and guess*guess).
If your guess isn't accurate enough, try again. Your new guess should be 0.5 * (last guess + X / last guess).
Keep going until your guess is close enough. Your class should include a recursive method for calculating the square root using the Babylonian Method.
Users of your class should be able to specify the number they'd like to take a square root of as well as how much error they will tolerate in the square root estimation. For testing purposes, you should print the output.
Write your program.
In addition to creating the class(es) specified, you'll need to create a main method that thoroughly tests each function you build to show that it works. You should do these things in parallel, not save testing for the end.
Here's a sense of how your workflow ought to go:
1. Write a function, documenting it as you go.
2. Write as many tests as you need in the main method to show that it works. Test both typical uses and atypical uses that might break it.