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

Another question on Engineering

question
Engineering, 03.07.2019 15:10
If you were designing a bumper for a car, would you prefer it to exhibit elastic or plastic deformation? why? consider the functions of a bumper in both a minor "fender-bender" and a major collision.
Answers: 1
question
Engineering, 04.07.2019 18:10
Afull journal bearing has a journal diameter of 27 mm, with a unilateral tolerance of -0.028 mm. the bushing bore has a diameter of 27.028 mm and a unilateral tolerance of 0.04 mm. the l/d ratio is 0.5. the load is 1.3 kn and the journal runs at 1200 rev/min. if the average viscosity is 50 mpa-s, find the minimum film thickness, the power loss, and the side flow for the minimum clearance assembly.
Answers: 1
question
Engineering, 04.07.2019 18:10
At 12 noon, the count in a bacteria culture was 400; at 4: 00 pm the count was 1200 let p(t) denote the bacteria cou population growth law. find: (a) an expression for the bacteria count at any time t (b) the bacteria count at 10 am. (c) the time required for the bacteria count to reach 1800.
Answers: 1
question
Engineering, 04.07.2019 18:10
Which one from below is not one of the reasons of planning failures? (clo3) a)-planner is careless. b-planner spend less time in the field but more time on the desk c)-planner is not qualified d)-planner does not have sufficient time to properly plan
Answers: 3
You know the right answer?
Task-1: In Cartesian coordinate system, a linear equation represents a line passing through two disc...
Questions
question
Mathematics, 26.06.2019 18:30
Questions on the website: 13722367