Answered step by step
Verified Expert Solution
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 setfloat float, float, float; sets data in the object
void getPoint & 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
Linefloat float float float; 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;
side.print;
return ;
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started