1 | /** |
2 | This program computes square roots of input values |
3 | supplied by a loop. |
4 | */ |
5 | public class RootApproximatorTest4 |
6 | { |
7 | public static void main(String[] args) |
8 | { |
9 | final double MIN = 1; |
10 | final double MAX = 10; |
11 | final double INCREMENT = 0.5; |
12 | for (double x = MIN; x <= MAX; x = x + INCREMENT) |
13 | { |
14 | RootApproximator r = new RootApproximator(x); |
15 | double y = r.getRoot(); |
16 | System.out.println("square root of " + x |
17 | + " = " + y); |
18 | } |
19 | } |
20 | } |