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?

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
Redundant or generalizable functions

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

Step: 3

blur-text-image

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

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions