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 22:30
What would be the address of the cell, which is at the intersection of the second row and the third column in a worksheet?
Answers: 1
question
Computers and Technology, 24.06.2019 09:00
Why might you chose to crest a function resume
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
During the software planning process, rick, a project manager, finds that his team has made an incorrect estimation of funds. what kind of risk has rick identified? rick has identified a risk.
Answers: 1
question
Computers and Technology, 24.06.2019 17:00
Carlos, an algebra teacher, is creating a series of powerpoint presentations to use during class lectures. after writing, formatting, and stylizing the first presentation, he would like to begin writing the next presentation. he plans to insert all-new content, but he wants to have the same formatting and style as in the first one. what would be the most efficient way for carlos to begin creating the new presentation? going under the file tab and opening the first presentation, deleting all content from each page, and adding new content going under the file tab and clicking on new in the left pane, then choosing new from existing going under the design tab and clicking on themes, then selecting the theme that was used for the first template going under the design tab and opening the template that was created for the first presentation
Answers: 2
You know the right answer?
1. A class Linear is defined as follows. class Linear {

pr ivate :

double a0...
Questions
question
Mathematics, 26.03.2021 18:10
question
Biology, 26.03.2021 18:10
question
Mathematics, 26.03.2021 18:10
question
Spanish, 26.03.2021 18:10
question
Biology, 26.03.2021 18:10
question
Chemistry, 26.03.2021 18:10
question
Biology, 26.03.2021 18:10
Questions on the website: 13722367