01: import java.util.Scanner;
02: 
03: /**
04:    This program prints ten approximations for a square root.
05: */
06: public class RootApproximatorTester
07: {  
08:    public static void main(String[] args)
09:    {  
10:       System.out.print("Enter a number: ");
11:       Scanner in = new Scanner(System.in);
12:       double x = in.nextDouble();
13:       RootApproximator r = new RootApproximator(x);
14:       final int MAX_TRIES = 10;
15:       for (int tries = 1; tries <= MAX_TRIES; tries++)
16:       {
17:          double y = r.nextGuess();
18:          System.out.println("Guess #" + tries + ": " + y);
19:       }      
20:       System.out.println("Square root: " + r.getRoot());
21:    }
22: }