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, 22.06.2019 16:20
Consider the following statements, then select one of the answers below: the signal() function shown below registers "sig_handler()" as the signal handler function for the sigkill signal, without the complexity of using when the sigkill signal is sent to a process running this code, by a user typing "kill -kill ", where the correct process id is used for to target the process, sig_handler() will be executed.
Answers: 1
question
Computers and Technology, 23.06.2019 01:00
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
1. ask the user how many questions are in the quiz. 2. ask the user to enter the key (that is, the correct answers). there should be one answer for each question in the quiz, and each answer should be an integer. e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. you will need to store the key in an array. 3. ask the user to enter the answers for the quiz to be graded. there needs to be one answer for each question. note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. 4. when the user has entered all of the answers to be graded, print the number correct and the percent correct. 5. add a loop so that the user can grade any number of quizzes with a single key. after the results have been printed for each quiz, ask "grade another quiz? (y/n)." note: you only have one array (the key). you are not creating a new key for each set of quiz answers.
Answers: 3
question
Computers and Technology, 23.06.2019 20:40
On nba 2k 19, every time i try to join a my park game, it leads ro a website telling my dad that he needs ps plus. i already have ps plus though. how do i fix this?
Answers: 2
You know the right answer?
1. A class Linear is defined as follows. class Linear {

pr ivate :

double a0...
Questions
question
Mathematics, 08.06.2021 19:10
question
Social Studies, 08.06.2021 19:10
question
Computers and Technology, 08.06.2021 19:10
question
English, 08.06.2021 19:10
question
English, 08.06.2021 19:20
Questions on the website: 13722367