Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

During which part of a nights sleep is REM most common?

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago