Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please code in Java and create a class for LinkedPolynomial.java TestPolynomial.java Polynomial.java Polynomial Implementation (ADT Implementation Using Linked Structures) Summary Implement the Polynomial interface using
please code in Java and create a class for LinkedPolynomial.java
Polynomial Implementation (ADT Implementation Using Linked Structures) Summary Implement the Polynomial interface using a private linked Node class. (NOT a Einkedtist 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 constructor. (The default constructor may be suitable.) Details I have provided you with an interface for a Polynomial data type. It contains only some basic methods (no methods for mathematical operations on full Polynomials, for example). I have also provided you with a sample client program. You SHOULD NOT modify those files. I 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 implementation. You are not allowed to make use of any reference types that you have not defined yourself. I recommend that you keep the Nodes in the order they get printed in. Thus the Polynomial 0.2x5+x2+3.5x+2.0 would be kept as the linked structure: head {]{0.25]{1.02]{3.511{2.00/] where the *s represent references and the / represents a nu11 reference. That's a recommendation, which means you don't have to do it that way!. You might not need to add a constructor to your class, but if you do make sure you have a no-arguments constructor. The method getDegree should be very easy. The methods evaluateAt and getcoefficient should be pretty easy. The add and tostring methods will be somewhat harder. I recommend you start with a partial implementation of add that just places the given term at the front of the list of terms. Then move on to tostring and get that printing each term 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.0x5+5.1x3+0.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, printing 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 as * An interface with some basic polynomial methods. A polynomial is the sum of * several terms, each of which is a multiple of a power of x. The powers are * non-negative integers. The multiple is double, and terms multiplied by zero * are ignored. The multiplier for a term is called its coefficient. * For example: * pre> * 0.2x5+1x2+3.5x1+2x0 * pre > has four (non-zero) terms, as follows: * >TestPolynomial.java
Polynomial.java
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