logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

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

expert
Mahima VatsAccounting
(/5)

734 Answers

Hire Me
expert
Marshall HildrethLaw
(5/5)

527 Answers

Hire Me
expert
Johan CornerOthers
(5/5)

734 Answers

Hire Me
expert
Lynette WhiteeGeneral article writing
(5/5)

955 Answers

Hire Me
Computer Science

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

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

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

. 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

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

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

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

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

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