Given a project called��chapter 7_11 (in c++) that contains;a) f.docx

This preview shows page 1 - 4 out of 7 pages.

given : a project called chapter 7_11 (in c++) that �� contains; a) file Point.h /*-------------------------------------------------------*/ /* Filename: Point.h */ #include<iostream> using namespace std; class Point { private: double xCoord, yCoord; //Class attributes public: //default constructor Point(); // parameterized constructor Point(double x, double y); // Overloaded operators double operator -(const Point& rhs) const; bool operator ==(const Point& rhs) const; // Accessor Methods double getX() const { return xCoord; } double getY() const { return yCoord; } // Mutator Methods void setX(double newX); void setY(double newY); void setXY(double newX, double newY); // Prin tmethod to cout void Point::print(ostream& out) const; }; b) file:file Point.cpp /*------------------------------------------------------*/
/* Class implementation for Point */ /* filename: Point.cpp */ #include "Point.h" //Required for Point #include<iostream> //Required for cout #include<cmath>//Required for sqrt()and pow() using namespace std; // Default constructor Point::Point() { cout << "\nConstructing Point object, default: \n"; cout << "initializing to zero" << endl; xCoord = 0.0; yCoord = 0.0; } //Parameterized constructor Point::Point(double x, double y) {

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture