The complete program is given below.
Translating the polynomial
7x3- 3x2 + 4x - 12
into Java is easy.
The term x3
means x
times itself three times,
so that is what the Java statement does.
The next statement
writes out the answer.
The +
operator concatenates the strings.
Remember that doubles are converted to strings automatically when you
use +
between a double and a string.
What happens in this program if the user types "yes" in response to the prompt continue (y or n)?