Question: Define the struct Point with components xCoordinate, and yCoordinate of type float. Define the class Line with the private data members first, and second of

Define the struct Point with components xCoordinate, and yCoordinate of type float.
Define the class Line with the private data members first, and second of type Point, length, and slope of type
float. The class also has the following public member functions:
void set(float, float, float, float); // sets data in the object
void get(Point &, Point &, float &, float &) const; // returns the data of the object
void print() const; // prints the data of the object
void findLength(); // finds the length of the line
void findSlope()// finds the slope of the line
Line(float=1, float=1, float=2, float=2); // default parametrize constructor
Save the struct and class definitions in the Line.h file, the main driver in the Line.cpp file, and the
implementation of the member functions in the LineImp.cpp file.
Implement all the member functions of the class and enforce the least privilege principle. Use the following
main program:
int main()
{
Line side;
side.set(2.3,3.7,6.8,5.1);
side.print();
return 0;
}
Sample input / output:
In mathematics, the slope or gradient of a line is a number that describes both the direction and the
steepness of the line.
2/2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!