Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have provided the interface and main class i have provided the main class (TestsPolynomials) and the interface (Polynomials) hope this helps Deraint Tins atatiz
I have provided the interface and main class i have provided the main class (TestsPolynomials) and the interface (Polynomials)hope this helps Deraint Tins atatiz sor nouth thas then 0,x3+x2+13x+50 Q(ix+3) (x2+2=3;+4)= 41a2+13 7 The Summary Implement the Polynomial interface using a private linked Node class. (NOT a finkeellist or any other data structure.) Your implementation must provide suitable code for each of the operations in that interface. It must also have a zero-arguments constr zto default constructor may be suitable.) Details Thave provided you with an interface for a Polynomial data type. It contains only some basic methods (no methods for mathentatical a Polynomials, for example). I have also provided you with a sample client program. You SHOULD NOT modify those files. 1 assume you are familiar with polynomials, but I have provided some information in the Polynomial javadoc. You must use a private Node class in your implenentation. You are not allowed to make use of any nyeence types that you have not I recommend that you keep the Nodes in the order tho y get printed in. Thus the Polynomial 0.2x5+x2+3.5x+2.0 would be kept as t = link head [+][0,25]{(1.02](3,51]{[2,00/] where the "s represent references and the / represents a null reference. That's a recomnendation, which means you don't have io do it that wayt. The methods evaluateAt and getcoofficient should be preity easy. The add and tostring methods will be somewhat harder. I reconmend you start with a partial implementation of add that just place front of the list of terms. Then move on to tostring and get that printing cacb ferm the way you want it printed. The output will not be entirely the way it needs to be, but each term printed should be OK. For example; you might see x2+3.8x5+5.1x3+6.2x5+x2+3.5x+2.0 After you've got tostring working as you want, you can then move on to making add behave properly. BONUS POINTS for replacing + signs with - signs and integer coefficients without decimal points, For example, priating 0.2x5+x2+3.5x+2.0 as 0.2x5+x23.5x+2 Be careful that you don't mess up the first term, which has no + sign in front of it to be changed. Thus we should not see 0.2x5+3.5x import java.util.scanner; 1/ add a constant term poly,add(2,,); show(poly); 11 add a linear term poly, add (3,5,1); show(poly); 11 add a quadratic term poly. add (1.0,2); show ( poly): 11 jump up a couple of powers poly.add(0.2, 5); show(poly): 11 go back and add a lower power poly.add (5.1,3); show(poly); 1/ adjust the coefficient of a power poly.add (3, 5); show(poly): II zero out a term poly.add (1.0,2); show (poly); 11 zero out al1 remaining terms poly.add (9,2,5). add (5.1,3). add(3.5,1), add (2,0); show ( poly i) Show that all the Polynomial methods work for this Polynomial. Gparam poly the Polynomial to show private static vod show(Polynomial poly) \{ Systen. out. println ( poly (x)=n+ poly); System. out. println ("poly,getDegree() ==+ poly.getDegree()); for (int i=0;i= poly getDegree ();+1){ System.out.printin("poly.getCoefficient(" +i+ ") = I poly.getCoefficient(i)); for (double x=1.0;x
I have provided the interface and main class
hope this helps
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started