What is 0.00000000000001 in scientific notation?

Eine gute Antwort könnte sein:

1.0E-14

Skeleton Square Root Program

Here is a skeleton of the Programm, with the Schleife condition translated from math into Java. The absolute value of a double is calculated by Math.abs(double).

class  SquareRoot
{
  public static void main( String[] args )
  {
    final double smallValue = 1.0E-14 ;
    double N     = 3.00 ;
    double guess = 1.00 ;

    while ( Math.abs( N/(guess*guess) - 1.0 ) > smallValue )
    {

       // calculate a new value for the guess

       
    }

    System.out.println("The square root of " + N + " is " + guess ) ;
  }

}

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 vervollständigen the Programm using just one variable, guess.

FRAGE 14:

vervollständigen the Programm by filling in the Schleife body. You should be able to type in your answer into the text area. (But nothing else will happen.)