Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task : Write a complete Project file ( main file, specification file and Implementation file) . Write the program in C++. Use linked lists to

Task: Write a complete Project file ( main file, specification file and Implementation file). Write the program in C++. Use linked lists to represent two polynomials. Each polynomial will be an object of the Polynomial class. Each node in the linked list will represent a term of the polynomial, so data members of the nodes will include coefficient and exponent.

Processing: The program should accept appropriate values (i.e., coefficient and exponent values) from the user to populate two polynomials. Simple data checking should verify that the integer exponents are non-negative and that coefficients are not zero. Polynomials may have varying numbers of terms. The terms should be stored in the linked list in decreasing order of their exponents.

For example, valid polynomials might be:

3 x to power 7 - 1.5 x to power 4 + 3 (stored as 3 nodes)

7.1 x to power 2 - 6x (stored as 2 nodes)

12 (stored as 1 node)

The program will perform three basic operations on the polynomials: add the two original polynomials together; output the sum subtract one of the original polynomials from the other one; output the difference perform monomial multiplication on one of the original polynomials (i.e., multiply each polynomial term by a given monomial term, not necessarily a scalar); output the monomial and the result

Note: Do not change the original two polynomials during the addition, subtraction or multiplication operations. Include appropriate functions in the class (constructors, etc.) to produce an effective object-oriented program.

Input: Be sure the program is flexible enough that polynomial terms may be supplied by the user out of proper order, but still be stored in proper order.

Output: Test program should allow the user to input the two polynomials and the monomial multiplier. Then output the following:

a) each of the two original polynomials

b) the sum of the polynomials

c) the difference (first polynomial minus the second)

d) another difference (second polynomial minus the first)

e) the result for each of the two polynomials being multiplied by a (different) monomial

Make sure your program in program is well documented both internally and externally.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago