A method to evaluate the polynomial

Assignment Help C/C++ Programming
Reference no: EM13867890

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. 

Reference no: EM13867890

Questions Cloud

What is the probability that neither a nor b will happen : The events A and B are mutually exclusive. Suppose P(A) = .30 and P(B) = .20. What is the probability of either A or B occurring? What is the probability that neither A nor B will happen?
Discuss the purposes or goals of policy advocacy : Discuss the purposes or goals of policy advocacy. What is it intended to achieve and for whom? Discuss a social policy (use equal opportunity) that has impacted or has the potential to impact you personally or professionally (such as the organizat..
What is the history of money''s influence in politics : What is the history of money's influence in politics
Using straight line amortization prepare journal entries : Simko Company issued $ 600,000, 10-year, 5 percent bonds on January 1, 2015. The bonds were issued for $ 580,000. Interest is payable annually on December 31. Using straight-line amortization, prepare journal entries to record (a) The bond issuance o..
A method to evaluate the polynomial : Your task is to design and develop a C++ class whose objects represent polynomials.A polynomial is shown as:anxn + an-1xn-1 + ... + a0To simplify things, you can safely assume that the power of x and the coefficients are all integers.
Find probability company will not lose money next quarter : Use an addition rule to find the probability the company will not lose money next quarter. Use the complement rule to find the probability it will not lose money next quarter.
Competing views of the small-group theory : Compare and contrast the competing views of the small-group theory and provide the most relevant information based on your research
Prepare journal entries to record the bond issuance : Clem Company issued $ 800,000, 10-year, 5 percent bonds on January 1, 2015. The bonds sold for $ 741,000. Interest is payable annually on December 31. Using effective-interest amortization, prepare journal entries to record (a) The bond issuance on J..
Create an essay question clearly specific to the article : Finally, create an essay question clearly specific to the article but one that you believe could be competently answered by anyone in the class that read the article. This question should be labeled "Essay Question."

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that prompts the user to input the masses

Write a program that prompts the user to input the masses of the bodies and the distance between the bodies. The program then outputs the force between the bodies.

  Prepare program to check the syntax of the english language

Determine the form of the output dependent on the coefficients being input. Print and evaluate with peers in class."

  Project

Unit 3 Individual Project SSCI210 – 1304B – 01 A typical individual who commits who commits hate crimes whether it is against or aimed at the Gay/lesbian community , the persons of color or the Jewish community, ( I mention these three because they a..

  Create a class called rational for performing arithmetic

Rational Class Create a class called Rational for performing arithmetic with fractions. Write a program to test your class. Use integer variables to represent the private data of the class-the numerator and the denominator. Provide a constructor th..

  Write a c++ code for how to learn oop

Write a C++ code for How to learn OOP (Object oriented programming) by CPP(C Plus Plus) - general-purpose programming language

  Write a program to determine a natural number

Write a program to determine if a natural number has only 2 and/or 3 as prime factors and how many of each factor (2 and 3) it does have.

  Program that asks user to enter text and show given output

Write a program that asks the user to enter some text and then displays that text with all e's and E's replaced with 3's and all s's and S's replaced by 5's.

  Write a small program to simulate a raffle

Write a small program to simulate a raffle (a gambling game) for a group with 100 members. You can simply identify each member with a no-duplicated ID numbers from 01 to 100. A number ticket with a positive 4-digits integer number will be randomly cr..

  You are the admissions office at abc medical university

You are the Admissions Office at ABC Medical University. You have a large number of applicants for a very few number of available openings at your school. As a result, you need to set some high admission standards. To be accepted, a student ..

  Write a recursive function that takes a string

Write a recursive function that takes a string as a parameter and prints its reversal in the same function in C++

  Write an abstract data type

Write an abstract data type in C++ or Java (find which language you used) for rational numbers (a numerator and a denominator, both in integers).

  Implement the vector class using inheritance

Is it better to implement the Vector class using inheritance (is-a relationship) or composition (has-a relationship). In other word, which one of the following gives a better implementation?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd