Question
Need method 1, 2 and 3 to complete in java using this polynomial class of linked list. public class Polynomial { // this is a
Need method 1, 2 and 3 to complete in java using this polynomial class of linked list.
public class Polynomial {
// this is a nested static class, it defines a type // all the instance varaibles can be access directly inside Polynomial class even though they have // private modifier private static class TermNode{ private double coefficient; private int exponent; private TermNode next;
public TermNode(int exp, double coeff, TermNode nextTerm ) { coefficient= coeff; exponent = exp; next = nextTerm; } }
// instance variables of Polynomial // first is the term of the Polynomial with the highest degree private TermNode first;
public Polynomial() { first = new TermNode(0,0, null); }
public Polynomial(double a0) { first = new TermNode(0,a0,null); }
1. public Polynomial(Polynomial p) { }
2. public void add_to_coef(double amount, int exponent) {
}
3. public String toString() {
}
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