subject

1. A class Linear is defined as follows. class Linear {

pr ivate :

double a0 ;

double a1 ;

pub l ic :

Linear (double , double) ;

double substitute (double) ;

void display () ;

} ;

Linear represents a linear expression in the form of

a0x + a1. (1)

In other words, a0 and a1 are a0 and a1 respectively in the class definition. The function substitute

computes and returns the value of (1) when x is substituted by the input argument of substitute.

The display function displays the expression (1) in the form of

a0 + a1*x

Write

(a) the two-argument constructor,

(b) the member function substitute and

(c) the member function display

of Linear.

Then derive Quadratic from Linear to handle quadratic expression objects in the form of

a0 + a1x + a2x

(2)

Include a2 of type double as the private member of Quadratic. Provide a three-argument constructor

for Quadratic. Override the member functions substitute and display. The substitute function

in Quadratic evaluates and returns (2) by substituting the value passed into the equation. The display

function of Quadratic prints the quadratic expression in the form of

a0 + a1*x + a2*x^2

Utilize the functions in Linear whenever possible. Explain how a product between two linear expressions can be computed in your program. In which class should the calculation be done?

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Your is an example of personal information that you should keep private.
Answers: 2
question
Computers and Technology, 25.06.2019 07:30
The can be used to paste text in any order.
Answers: 1
question
Computers and Technology, 25.06.2019 08:00
Is skill in using productivity software, such as word processors, spreadsheets, database management systems, and presentation software.computer literacyinformation literacybusiness literacynetwork literacy
Answers: 1
You know the right answer?
1. A class Linear is defined as follows. class Linear {

pr ivate :

double a0...
Questions
question
Mathematics, 16.10.2020 20:01
question
Computers and Technology, 16.10.2020 20:01
question
Mathematics, 16.10.2020 20:01