Question: 1. Convert the following C++ code to equivalent Java. (For Java, Math.abs (double x) returns the absolute value of x) double poly(double x) {
1. Convert the following C++ code to equivalent Java. (For Java, Math.abs (double x) returns the absolute value of x) double poly(double x) { return 3* x* x + 2 * x - 3; } double dpoly(double x) { return 6* x + 2; } double findZero (double start) { if (abs (poly (start)) < .00001) return start; double next = start poly (start) / dpoly (start); return findZero (next); } int main() { double first = 0.0; cout < < "One zero of 3x^2 + 2x - 3 is approximately: " < < findZero (first) < < endl; return 0;
Step by Step Solution
3.45 Rating (158 Votes )
There are 3 Steps involved in it
Here is the equivalent Java code for the given C code java pu... View full answer
Get step-by-step solutions from verified subject matter experts
