# Thread: I don't get what this is asking me to do...

1. Member
Join Date
Apr 2011
Posts
7
Rep Power
0

## I don't get what this is asking me to do...

I have an assignment out of my Java book and I'm not asking for anyone to code anything for me but I am asking if anyone can clarify what the book is trying to have me accomplish:

20. The following defines a function that calculates an approximation of the square root of a number, starting with an approximate answer(approx), within the specified tolerance(to1).

{approx | if|approx^2 - number| <= tol
sqrRoot(number,approx,tol) = {sqrRoot(number,(number^2 + number) / (2* approx), tol) | if|approx^2 - number | > tol

Write a recursive and non-recursive method of the sqrRoot method.

2. ## Re: I don't get what this is asking me to do...

Are you sure you copied this code correctly? Please use proper indentation to make it easier for us to read. It looks like they want you to write two methods on calculating a method which finds the square root of some number.

3. ## Re: I don't get what this is asking me to do...

Originally Posted by colerelm
Java Code:
```                                        {approx                                                                       | if|approx^2 - number| <= tol
sqrRoot(number,approx,tol) = {sqrRoot(number,(number^2 + number) / (2* approx), tol)   | if|approx^2 - number | > tol```
Cute; what language is this? It doesn't mind unbalanced brackets ...

kind regards,

Jos

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•