Question: Create a polynomial class with linked lists and implement some basic functions in java . Polynomials are stored in a linked list of Term objects

Create a polynomial class with linked lists and implement some basic functions in java.

Polynomials are stored in a linked list of Term objects (two classes: Polynomial and Term). Term objects have two data fields: coefficient and exponent, both integers; all exponents will be positive. Polynomial will have some methods that create linked list functionality, but not all list operations are needed; include only those used by this program. Do not use a separate linked list class.

These are the basic polynomial functions: read a polynomial from the user, read a polynomial from a file, add two polynomials (output to screen and file), evaluate a polynomial (output to screen and file). Evaluate takes a value for x (the variable), then calculates the polynomials value.

Methods in the polynomial class.

add two polynomials: some terms may be missing, polynomials may be different lengths

read polynomial from file: prompt user for filename; assumptions: the file exists and is readable, the polynomials are correctly formatted

read polynomial from user, assumption: perfect user

print polynomial coefficients of 1 do not print, terms with a zero coefficient do not print

evaluate polynomial x values will be integers.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!