Computers and Technology

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?

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, karena13aguirre
Problems: 1. using textbooks, reference books, and internet as your source of research, draw the following microprocessor microarchitectures i. intel 8086 ii. motorola 68000 i atmel atmega32 iv. mips single cycle v. arm cortex-m3 write an hdl module for a hexadecimal seven-segment display decoder. the input is 4-bit binary representing a hex number (0-f), and the output is 8-bit seven segment display bits (a-h). thus, the decoder must handle the digits 10 - 15 to display a-f respectively, in addition to 0-9 numbers. 2. design a 4-bit left and right rotator (both outputs). first sketch schematic diagrams of your design. then implement your design using hdl coding. 3. 4. design a modified priority encoder that receives an 8-bit input, a7: 0 and produces a 3-bit output, y2o. y indicates the most significant bit of the input that is true. y should be 0 if none of the inputs are true. give a simplified boolean equation, sketch a schematic, and write an hdl code. 5.write an 8: 1 multiplexer module called mux8 with selection inputs s, data input d, and data output y. data input (d) and data output (v) are 32-bit wide
Answers: 3
image
Computers and Technology, 22.06.2019 18:30, dpinzoner5952
Which of the following commands is more recommended while creating a bot?
Answers: 1
image
Computers and Technology, 22.06.2019 19:10, sammigrace5820
How might the success of your campaign be affected if you havenโ€™t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, HannahVance99
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
Do you know the correct answer?
1. A class Linear is defined as follows. class Linear {

pr ivate :

double a0...

Questions in other subjects:

Konu
Mathematics, 10.05.2021 19:10
Konu
English, 10.05.2021 19:10