Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions