For Part B of the warm-up, you are to create a polynomial class in Java using a linked structure The polynomial class should consist of a linked list of nodes accessed through head. You will need to create a class of terms (Objects representing the individual terms of the polynomial) The polynomial class will consist of linked nodes: class polynomial{ private node head; private int degree; The node (a node class in the same folder/package): protected terms term; protected node next; The terms (in the same folder/package) will consist of: protected double coeff; protected int power; And member methods: constructor(s) evaluate(x) add- which will add a polynomial q to the given polynomial p = p+q subtract – which will subtract a polynomial q from the given polynomial p = p-q scale = which will multiply the given polynomial by a constant a p =ap multiply – which will multiply the given polynomial by a polynomial q p = p*q and polynomial methods: sum – which adds 2 polynomials and creates a new polynomial without destroying the original r = p+q diff - which subtracts 2 polynomials and creates a new polynomial without destroying the originals r = p-q product - which multiplies 2 polynomials and creates a new polynomial without destroying the original r = p*q The polynomial should maintain the terms in order, sorted by the power. (hint: use the insertSorted method we designed in lecture, with the “order” using term.power.) You do not need to use the LinkedList class to do this project! You are just using the linked-structure style to manage the polynomials.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

For Part B of the warm-up, you are to create a polynomial class in Java using a linked structure

The polynomial class should consist of a linked list of nodes accessed through head.
You will need to create a class of terms (Objects representing the individual terms of the polynomial)

The polynomial class will consist of linked nodes:

class polynomial{
private node head;
private int degree;

The node (a node class in the same folder/package):
protected terms term;
protected node next;

The terms (in the same folder/package) will consist of:
protected double coeff;
protected int power;
 

And member methods:
constructor(s)
evaluate(x)
add- which will add a polynomial q to the given polynomial  p = p+q
subtract – which will subtract a polynomial q from the given polynomial  p = p-q
scale = which will multiply the given polynomial by a constant a     p =ap
multiply – which will multiply the given polynomial by a polynomial q    p = p*q

and polynomial methods:
sum – which adds 2 polynomials  and creates a new polynomial
           without destroying the original   r = p+q
diff -  which subtracts 2 polynomials  and creates a new polynomial
           without destroying the originals   r = p-q
product - which multiplies 2 polynomials  and creates a new polynomial
           without destroying the original r = p*q

The polynomial should maintain the terms in order, sorted by the power. (hint: use the insertSorted method we designed in lecture, with the “order” using term.power.)

You do not need to use the LinkedList class to do this project!  You are just using the linked-structure style to manage the polynomials.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 6 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education