Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Your task is to design and develop a C++ class whose objects represent polynomials.
A polynomial is shown as:anxn + an-1xn-1 + ... + a0
To simplify things, you can safely assume that the power of x and the coefficients are all integers.
Your Polynomial class should provide at least the following methods:
 1 A default contructor, that produces a polynomial that has only a constant term of 0.
 2 A constructor with a single argument of type int, that produces the polynomial that has only one constant term that is equal to the 
constructor argument.
 3 A constructor with three arguments, two int arrays and an int typed size. The first array stores exponents of the terms and the second 
array stores the coefficients of the corresponding terms.
 4 A copy constructor. 
 5 A suitable destructor. 
 6 A method to evaluate the polynomial. This method has one argument of type int, and returns the value obtained by plugging in its 
argument for x and performing the indicated operations.
 7 Overload the operators +, -, and * for addition, subtraction, and multiplication of polynomials.
 8 As friend functions, overload input operator and output operator to input and output polynomials.When the user inputs a polynomial, the user types in a list of integer pairs. In each pair, the first is the exponent of the term and the second is the coefficient of the term. A pair starts with 0 (meaning constant term) indicates the end of the input for this polynomial. For example, the polynomialx7 + 3x4 - 5x3 + 2
will be entered by a user as:
 7 1
 4 3
 3 -5
 0 2
and the output should be shown as:
 x^7 + 3x^4 - 5x^3 + 2
And as another example, the polynomial
2x4 + x3 - x2
will be entered by a user as:
 4 2
 3 1
 2 -1
 0 0
and the output should be shown as:
 2x^4 + x^3 - x^2
For a sample main function to test the Polynomial class, click here. You need to include your own main function to test your Polynomial class.Design and DocumentationYou need to make and document decisions about which concrete data structure(s) to use for your Polynomial class implementation.You need to develop a README file as a way of design documentation. In your README file (Note: do not give it any extension name), there should be following sections:
 1 Overview: briefly describe the requirement of this program, especially of the class Polynomial.
 2 Design: briefly describe the modules in your design and why you choose your current design.
 3 Implementation: briefly describe the concrete data structures used in each module. List the advantage and disadvantage of using these data structures. Explain whether there are alternative ways to implement this program.
 4 Accomplishment: state clearly which parts of the assignment you completed.
 5 Testing: list the test cases you have covered to test your program. For each test case, describe the data you used and the result shown by your program. Alternatively, if you used script to capture the sample run of your program, then you only need to describe your test cases and refer to your typescript file for the test run result.
 6 Know Bugs. 
 7 Note: anything you would like to draw to the attention of the marker. Your source code file(s) should have the usual documentation as 
mentioned in the first assignment.Create a Makefile to automate the building of your program. Upon typing make, an executable file named pex2 should be generated. 

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91528570
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question?


Related Questions in C/C++

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As