subject
Engineering, 14.05.2021 02:30 kaylazeiter

Task-1: In Cartesian coordinate system, a linear equation represents a line passing through two discrete points, such as, (1, 1) and (4, 2), respectively. Hence, one can easily describe the “point” object with a C++ class as given below.
class Point {
public:
Point(); //default constructor
Point(…); //parameterized constructor
Point(…); //copy constructor
~Point(); //destructor
… set_x(…); //some member functions
… set_y(…);
… get_x(…);
… get_y(…);
… print(); //prints the point object using some format, e. g., [1,2]
private:
int x, y; //data members
};
On the other hand, in order to create a “line” object, one can think of executing data composition technique where
the line object is composed of two discrete point objects. Hence, one can write the following:
class Line {
public:
Line(); //default constructor
Line(…); //parameterized constructor
Line(…); //copy constructor
~Line(); //destructor
… set_point1(…); //some member functions
… set_point2(…);
… get_slope(); //calculates the slope value
… print(); //prints the line object using some format
//e. g., A line passing through [2,2] and [4,4] with slope = 1.0
private:
Point p1, p2; //data composition!
};
a. Write definitions of the member functions listed above.
b. Rewrite the program by separating the implementation file from the interface using a header file.
 Provide a driver program to test each implementatio

ansver
Answers: 2

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, caitlynnpatton1208
Water in a partially filled large tank is to be supplied to the roof top, which is 8 m above the water level in the tank, through a 2.2-cm-internal-diameter pipe by maintaining a constant air pressure of 300 kpa (gage) in the tank. if the head loss in the piping is 2 m of water, determine the discharge rate of the supply of water to the roof top in liters per second.
Answers: 3
image
Engineering, 04.07.2019 18:10, agpraga23ovv65c
Carbon dioxide gas expands isotherm a turbine from 1 mpa, 500 k at 200 kpa. assuming the ideal gas model and neglecting the kinetic and potential energies, determine the change in entropy, heat transfer and work for each kilogram of co2.
Answers: 2
image
Engineering, 04.07.2019 18:20, moneywaydaedae
Air is compressed isentropically from an initial state of 300 k and 101 kpa to a final temperature of 1000 k. determine the final pressure using the following approaches: (a) approximate analysis (using properties at the average temperature) (b) exact analysis
Answers: 1
image
Engineering, 04.07.2019 18:20, Doogsterr
For each of the following process: a) sketch the p-v diagram, b)sketch t-s diagram, c) sketch t-v diagram, d) sketch the boundary work on one of the diagrams (a, b or c) and e) sketch the reversible heat transfer on one of the diagrams (a, b or c): 1- isobaric process from compressed liquid to superheated vapor 2- isothermal process from compressed liquid to superheated vapor 3- isentropic process from compressed liquid to superheated vapor
Answers: 3
You know the right answer?
Task-1: In Cartesian coordinate system, a linear equation represents a line passing through two disc...

Questions in other subjects:

Konu
Biology, 06.10.2019 04:01
Konu
Mathematics, 06.10.2019 04:01