logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

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.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

POLYNOMIAL

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).

ADT

Polynomial

Domain

Polynomial functions with integer coefficients.

Operations

constructors

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

evaluate

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

add

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

subtract

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

multiply

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

multiply

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

raiseDegree

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

raiseDegree

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

equal

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

getDegree

The degree of a Polynomial instance.

getCoefficient

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

print

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.

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

10b - OOP: Composition.

  1. The following files are provided

1.   guarded_array.h

  1. cpp
  2. h
  3. cpp
  4. h
  5. cpp (to work on)
  6. cpp (to work on)

8.   Makefile

  • Supply your Polynomial class with three
    1. The default constructor initializes a Polynomial instance to a zero
    2. 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.
    3. 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.
  1. The main function should compute (using the Polynomial class) and print the following:
  2. The zero
  3. The degree of the zero
  4. The value of the zero polynomial when x = 1.
  5. The polynomial S(x) of your student number
    • g. for student number 200543210
  • S(x) = 2 + 5x3 + 4x4 + 3x5 + 2x6 + x7
  1. The degree of S(x).
  2. The value of S(1) and S(-2).
  3. 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
  1. The polynomial S(x) + Q(x).
  2. The polynomial S(x) - Q(x).
  3. The polynomial S(x) * 4.
  4. The polynomial Q(x) * x2.
  5. The polynomial S(x) * Q(x).

BASE SAMPLE OUTPUT 

HAND IN

 

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

■     Name

  • Student Number
  1. Submit ONLY 1 .zip containing

1.    guarded_array.h

  1. cpp
  2. h
  3. cpp
  4. h
  5. cpp (to work on)
  6. cpp (to work on)
  7. Makefile
    • DO NOT submit any other files (e.g. binary files)
      • Marks will be deducted if instructions are not properly
  1. Your C++ program MUST compile using g++ -std=c++98 or g++ -std=c++11

under Hercules.

  1. Submit your files through

 

 

MARKING SCHEME

 

 

Marking scheme : total = 100%

 

I.             Readability (program style) : 20%

  • The program easy to read,
  • well commented,
  • good structured
    • layout, indentation, whitespace, . . .
  • good designed
    • following the top-down approach

II.              Compiling and execution process: 10%

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

III.              Correctness: 70%

  • code produces correct results (output)

output meets the initial requirements (see above

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

749 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

764 Answers

Hire Me
expert
Husnain SaeedComputer science

753 Answers

Hire Me
expert
Atharva PatilComputer science

960 Answers

Hire Me