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

isHorizontal() - This member function returns whether a line is horizontal (i.e.

ID: 3676856 • Letter: I

Question

isHorizontal() - This member function returns whether a line is horizontal (i.e., in parallel to the x-axis).

isVertical() - This member function returns whether a line is vertical (i.e., in parallel to the y-axis).

getDistance(line2) - This member function computes and returns the distance between the current and Line2, specified as a parameter, if they are parallel. If not parallel, return 0, since they intersect. (wiki)

isParallel(line2) - This member function checks whether the current line and line2 are parallel.

isPerpendicular(line2) - This member function checks whether the current line and line2 are perpendicular.

// Returns true if the line is horizontal
bool isHorizontal(){
    // TODO: Fill me in
    return true;
}

// Returns true if the line is vertical
bool isVertical(){
    // TODO: Fill me in
    return true;
}

// Return the distance between two lines. If they intersect, return 0.0.
// Return value should always be positive.
double getDistance(Line line2){
    // TODO: Fill me in
    return 0.0;
}

// Return true if the two lines are parallel. Be sure to return the
// correct result if they are both vertical!
bool isParallel(Line line2){
    // TODO: Fill me in
    return true;
     
}

// Return true if the two lines are perpendicular. Be sure to return the
// correct result if they one is vertical.
bool isPerpendicular(Line line2){
    // TODO: Fill me in
    return true;
}



};

Explanation / Answer

/////////////////////////////////////////////////////////////////////////////////////////////////////////////