Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a class Polynomial with three private data members a, b and c (type double) to represent the coefficients of a 2-degree polynomial :(ax 2

Define a class Polynomial with three private data members a, b and c (type double) to represent the coefficients of a 2-degree polynomial :(ax2 + bx + c).Include a constructor in the Poly class to initialize private data members with user-supplied values (in addition to the default constructor). The class overloads the addition(+)and subtraction (-) operators to return the sum/subtraction of two polynomial objects. Also define a showpoly() member function to output Poly objects in the specified format, i.e. ax2 + bx + c where a, b and c are the coefficients. Do not display the terms with (x2 or x) if these have zero coefficients. Moreover, if the value of the coefficient is negative it should be preceded by a minus sign.Also overload equality operator (= =) that compares the two quadratic polynomials numbers and returns the result in Boolean form.

Class also overloads the increment (++) and decrement (--) operator that increases and decreases the value of all coefficients of a polynomial equation. Besides, class also have the Copy Constructor and destructor. Make the appropriate member function as const.

In your main () function, declare and initialize Poly objects, to represent the polynomials equation.

Hint: you may include "math.h" header file for using mathematical functions (e.g. sqrt() for calculating the square root of a value)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

Students also viewed these Programming questions