Question: PROGRAMMING LANGUAGE: C++ NOTE: this question need to be implemented using separate headers and cpp files. the headers files in this case will be node.h
PROGRAMMING LANGUAGE: C++
NOTE:
this question need to be implemented using separate headers and cpp files.
the headers files in this case will be
node.h
polylist.h
The cpp files in this case will be
node.cpp
polylist.cpp
driver.cpp
QUESTION:
Write down a C++ class called PolyList which allows a user to make a polynomial equation list using term nodes. A sample PolyList ADT class is given below, you can create more utility functions if required.
Class PolyList{
public:
Node *head;
PolyList();
~PolyList();
void insert_term(int coeff, int exp);
void delete_term(int exp);
bool isEmpty();
bool isPresent(int exp);
void display();
};
Using the above class ADT make a menu for users in main program that allows them to:
Create 1st polynomial
Create 2nd polynomial
Add two polynomials
Multiply of two polynomials
Evaluate a polynomial equation if value of the variable is (i.e. 'x') is entered by the user
Addition, multiplication and evaluation should be performed by non-member (stand-alone) and should not be created as member functions of the PolyList class.
SAMPLE OUTPUT:
Enter your choice (1-6):
1. Create 1st polynomial
2. Create 2nd polynomial
3. ADD two polynomials
4. MULTIPLY two polynomials
5. EVALUATE a polynomial
6. QUIT
Enter choice # 1
Enter the size of the polynomial equation: 4
Enter coefficient of term1: 8
Enter exponent of term2: 4
.......
.......
.......
poly1: 8x^4 + 4x^3 -3x + 9
Enter your choice (1-6):
1. Create 1st polynomial
2. Create 2nd polynomial
3. ADD two polynomials
4. MULTIPLY two polynomials
5. EVALUATE a polynomial
6. QUIT
Enter choice # 2
Enter the size of the polynomial equation: 5
Enter coefficient of node1: 4
Enter exponent of node1: 5
.......
.......
.......
poly2: 4x^5 + 8x^4 + 2x^3 -1x + 12
Enter your choice (1-6):
1. Create 1st polynomial
2. Create 2nd polynomial
3. ADD two polynomials
4. MULTIPLY two polynomials
5. EVALUATE a polynomial
6. QUIT
Enter choice # 3
First polynomial=> poly1
Second polynomial=>poly2
Sum: 4x^5+16x^4 + 6x^3 -4x + 21
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
