A polynomial is a function of the following form:

f (x)= a0 +a1x+ a2x2 +a3x3 +… + anxn

where an

is not zero if

n is not zero. The constants

ai 's are called the coefficients, and the

number n is said to be the degree of the polynomial.

You have specified, designed and implemented a C++ class that implements the following ADT (the ones highlighted is your task to implement).

Polynomial

Domain

Polynomial functions with integer coefficients.

constructors

Supply your Polynomial class with three constructors. More details below.

Apply the Polynomial function to an integer argument. That is, compute the value of the Polynomial for a given value of x.

An arithmetic addition operation that adds one instance of Polynomial to another.

An arithmetic subtraction operation that subtracts one instance of Polynomial by another.

An arithmetic multiplication operation that multiplies one instance of Polynomial by another.

An arithmetic multiplication operation that multiplies an instance of Polynomial by an integer.

An arithmetic multiplication operation that multiplies an instance of Polynomial by a polynomial of the form xk for some non-negative integer k.

An arithmetic multiplication operation that multiplies an instance of Polynomial by a polynomial of the form x. No arguments taken.

A Boolean operation that compares two instances of Polynomial to determine if they are identical.

The degree of a Polynomial instance.

Retrieve the coefficient of the term xk in a Polynomial instance, given a non-negative integer k.

Print a Polynomial instance in a user-friendly format.

Implement the ADT as a class, and the ADT operations as member functions. Make sure your implementation conforms to the following requirements.

- For more details about object composition and ManagedArray, consult the lecture

- The following files are provided

- cpp
- h
- cpp
- h
- cpp (to work on)
- cpp (to work on)

- Supply your Polynomial class with three
- The default constructor initializes a Polynomial instance to a zero
- A second constructor takes an integer array size and an integer array as arguments, and initializes the target Polynomial instance with coefficients identical to the elements of the array. A precondition for this operation is that the last element of the array must be non-zero, or else the array size is zero.
- A third constructor takes two integers. The first one indicates how many coefficients will be The second is the value that will be used to all those coefficients.

- The main function should compute (using the Polynomial class) and print the following:
- The zero
- The degree of the zero
- The value of the zero polynomial when x = 1.
- The polynomial S(x) of your student number
- g. for student number 200543210

- S(x) = 2 + 5x3 + 4x4 + 3x5 + 2x6 + x7

- The degree of S(x).
- The value of S(1) and S(-2).
- The polynomial S(x) of your student number with -1 wherever there is a 0

- g. for student number 200543210

- S(x) = 2 - x - x2 + 5x3 + 4x4 + 3x5 + 2x6 + x7 - x8

- The polynomial S(x) + Q(x).
- The polynomial S(x) - Q(x).
- The polynomial S(x) * 4.
- The polynomial Q(x) * x2.
- The polynomial S(x) * Q(x).

BASE SAMPLE OUTPUT

HAND IN

- Add as a header comment in cpp and test_polynomials.cpp files:

- Student Number

- Submit ONLY 1 .zip containing

- cpp
- h
- cpp
- h
- cpp (to work on)
- cpp (to work on)
- Makefile
- DO NOT submit any other files (e.g. binary files)
- Marks will be deducted if instructions are not properly

- DO NOT submit any other files (e.g. binary files)

- Your C++ program MUST compile using g++ -std=c++98 or g++ -std=c++11

under Hercules.

- Submit your files through

Marking scheme : total = 100%

- The program easy to read,
- well commented,
- good structured
- layout, indentation, whitespace, . . .

- good designed
- following the top-down approach

- program compiles without errors and warnings
- robustness: execution without run time errors

- code produces correct results (output)

output meets the initial requirements (see above

CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,

Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This

7COM1028 Secure Systems Programming Referral Coursework: Secure

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

344 Experts Online