Question: As part of a program that will be doing computations on various geometric objects, a programmer has submitted the following class declaration for approval. struct

As part of a program that will be doing computations on various geometric objects, a programmer has submitted the following class declaration for approval.

struct Line {

// Provide access to the endpoints

Point p1;

Point p2;

// Create a line segment

Line() {}

// Create a line segment with the given endpoints

Line (Point endPoint1, Point endPoint2);

// For a given x value, what is the corresponding value of

// y along this line segment? (Returns std::DBL_MAX if no

// such y exists or if y is not unique.)

double y(double x) const;

// For a given y value, what is the corresponding value of

// x along this line segment? (Returns std::DBL_MAX if no

// such x exists or if x is not unique.)

double x(double y) const;

// Returns true if these line segments intersect at a point that lies

// at or between the endpoint of each segment.

bool crossesSegment (const Line& segment) const;

// Returns true if p lies along this line segment (and at or

// between the endpoints).

bool contains (Point p) const;

};

ostream& operator<< (ostream& out, Line& line);

Based upon this information, which of the C++ checklist items appear to be in violation? (Choose all that apply)

Redundant or generalizable functions

Meaningful names

Undocumented pre-conditions

All data members private

Every constructor initializes every data member

Appropriate treatment of default constructor

Appropriate treatment of the Big 3

Appropriate relational operators

Appropriate output function

Const correctness

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!