What is 0.00000000000001 in scientific notation?
1.0E-14
Here is a skeleton of the program, with the loop condition
translated from math into Java.
The absolute value of a double is calculated by Math.abs(double).
Remember the formula for updating the guess:
newGuess = N/(2*oldGuess) + oldGuess/2
Remember,
in an assignment statement,
the variable on the left of the =
is updated by
giving it the value that is calculated on the right.
This allows you to complete the program using
just one variable, guess
.
Complete the program by filling in the loop body. You should be able to type in your answer into the text area. (But nothing else will happen.)