Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started