Question: Write the code for the rational zero test in the following java program: public void quadratic(){ int a = polynomial.get(0); int b = polynomial.get(1); int

Write the code for the rational zero test in the following java program:

public void quadratic(){ int a = polynomial.get(0); int b = polynomial.get(1); int c = polynomial.get(2); int root1 = (int) ((-b+Math.sqrt(b*b-4*a*c))/2); int root2 = (int) ((-b-Math.sqrt(b*b-4*a*c))/2);

roots.add(root1); roots.add(root2); } public int rationalZeroTest(){ int root=0; return root; } public void synthetic(){ } public void factor(){ if(polynomial.size() == 3){ quadratic(); } int root = rationalZeroTest(); synthetic(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!