1. Write the class PolynomialNode that contains the fields coef and exp of type int and an attribute next that refers to the next node. 2. In the PolynomialNode class, write 3 constructors that are defined as follows: a. PolynomialNode(): initializes the coef and exp to 0, and next to null. b. PolynomialNode(int coef, int exp): assigns values coef and exp, and next to null. c. PolynomialNode(int coef,int exp, PolynomialNode next): assigns values coef, exp, and next.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

java

please those two parts

2. Linked Lists
In this exercise, we will implement a Polynomial class to represent a polynomial
equation using linked list where each node corresponds to a term cxº, where c is the
coefficient and e is the exponent.
The following is an example of the representation structure of the polynomial:
10x3 + 5x2 + 3x + 5
head
10
5
3
5
3
2
1
1. Write the class PolynomialNode that contains the fields coef and exp of type
int and an attribute next that refers to the next node.
2. In the PolynomialNode class, write 3 constructors that are defined as follows:
a. PolynomialNode(): initializes the coef and exp to 0, and next to null.
b. PolynomialNode(int coef, int exp): assigns values coef and exp, and
next to null.
c. PolynomialNode(int coef,int exp,PolynomialNode next): assigns
values coef, exp, and next.
Transcribed Image Text:2. Linked Lists In this exercise, we will implement a Polynomial class to represent a polynomial equation using linked list where each node corresponds to a term cxº, where c is the coefficient and e is the exponent. The following is an example of the representation structure of the polynomial: 10x3 + 5x2 + 3x + 5 head 10 5 3 5 3 2 1 1. Write the class PolynomialNode that contains the fields coef and exp of type int and an attribute next that refers to the next node. 2. In the PolynomialNode class, write 3 constructors that are defined as follows: a. PolynomialNode(): initializes the coef and exp to 0, and next to null. b. PolynomialNode(int coef, int exp): assigns values coef and exp, and next to null. c. PolynomialNode(int coef,int exp,PolynomialNode next): assigns values coef, exp, and next.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
History of Java
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning