Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

the equation of a line is ax + by =c, where both a and b can not bezero, and a a

ID: 3612611 • Letter: T

Question

the equation of a line is ax + by =c, where both a and b can not bezero, and a and b and c are real numbers.
if b is not zero, then -a/b is the slope line
if a is zero (a=0) it is a horizontal line
if b is zero (b=0) then it is a vertical line. Tha slope of avertical line is undifined.
two lines are parallel if they have the same slope or both arevertical lines.
two lines are perpendicular if either one of the lines ishorizontal and the other is vertical or the product of either slopeis -1.
design the class line. Your class must contain the followingoperations:
a. is the line is nonvertical determine its slope.
b. determine if the two lines are equal
c. determine if the two lines are parallel
d. determine if the two lines are perpendicular.

add appropiate constructors to initialize data members of classline.
Also write a main program to test your class.


Explanation / Answer

#include #include using namespace std; class Line { private:      double a;    double b;    double c; public:     Line(double p,double q);     Line(double p, double q, double r); /* secondconstructor..which will take initialize a year with the given value*/     void Line::determineSlope();    void Line::equal(Line l);    void Line::parallel(Line l);    void Line::perpendicular(Line l); }; Line::Line(double p, double q) {        a=p;    b=q;    c=0; } /* definition of constructor 2 */ Line::Line(double p, double q,double r) {        a=p;    b=q;    c=r; } void Line::determineSlope() {     if(b !=0)    {        double slope = (-a/ b);        cout