Question: PART 2 : PolyCalculator ( 6 0 Marks ) Java You are tasked with implementing a simple polynomial calculator using linked lists in Java. Practically,
PART : PolyCalculator Marks Java
You are tasked with implementing a simple polynomial calculator using linked lists in Java.
Practically, there is a small change in the implementation of the linked list in this part compared
to the first part: the nodes contain data values: the coefficient and the exponent of each term
in the polynomial. You can copy your implementation from part making the necessary
changes to make it work for the given requirements.
You are required to implement the following member functions methods in the
PolyCalculator class as described below.
Each linked list list and list in the PolyCalculator class represents a single polynomial
expression.
Storing the Polynomial in a Linked List:
A polynomial expression can be stored in a Linked List by representing each term as a node of
the linked list. Each node of the list contains the coefficient and exponent of each term,
respectively. For example, the expression can be stored in a Linked List as
follows:
Member Functions to Implement:
Polycalculator:
Simple default constructor.
input:
Inputs the expression by the user in the format and stores it in list
and list
You can assume that the input will always have the same format ie or
numberx Valid expressions include: Invalidnumber
expressions include: you will not be tested on these
addLinkedListPoly I LinkedListPoly :
This function will add the expressions in the two polynomials stored in I and I
and store the result in a new polynomial 'result'. It will return this new polynomial.
subtractLinkedListPoly I LinkedListPoly I:
This function will subtract the expressions in the two polynomials stored in I and
and store the result in a new polynomial 'result'. It will return this new
polynomial.
void printLinkedListPoly I:
This function will print the list stored in the LinkedListPoly in the correct
format.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
