Question: Problem Statement Design a class 'Point that saves the x and y coordinates and has the following functions: class Point { private: double xval, yval;

 Problem Statement Design a class 'Point that saves the x and

Problem Statement Design a class 'Point that saves the x and y coordinates and has the following functions: class Point { private: double xval, yval; public: // Constructor uses default arguments to allow calling with zero, one, or two values. // Extractors (getter functions to get value of x and y) // Distance to another point. Pythagorean thm. // Add or subtract two points. // Move the existing point. // Print the point on the stream. The class ostream is a base class // for output streams of various types. }; void prline (ostream&strm, Point x, char *op, Point y, Point z) { // Print a line of the form x op y = z, where x, y, and z are points. } void main() {// Some points. Point a(5.2, -4.8); Point (3.0, 9.0); Point c(-3.38); Point d; // Some arithmetic op on the points. d = b.sub(c); prline (cout, b, "-", c, d);// Print a line of the form x op y = Z, where x, y, and z are points. prline (cout, a, "+", b, a.add(b)); a.print(cout); cout

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!