go to previous page   go to home page   go to next page hear noise

Answer:

The loop (and the program) stops because the user did not type "y".


Example Dialog

The program is not as user friendly as we would like. It insists that the user enter exactly "y" to continue.

This problem could be fixed with a few extra statements. But let's not. Here is a sample user dialog with the program:


C:\users\default\JavaLessons\chap18>java EvalPoly

Enter a value for x:
-1
The value of the polynomial at x = -1.0 is: -26.0

continue (y or n)?
y
Enter a value for x:
1
The value of the polynomial at x = 1.0 is: -4.0

continue (y or n)?
y
Enter a value for x:
1.178
The value of the polynomial at x = 1.178 is: -0.008209736000004852

continue (y or n)?
yes

C:\users\default\JavaLessons\chap18>

QUESTION 22:

At about what value for x does the polynomial evaluate to zero?