/* File: Point.cpp */

#include "Point.h"
#include <math.h>
#include <iostream>
using namespace std;

Point:: Point() { 
	_x = 0.0; 
	_y = 0.0; 
}

Point:: Point(double x, double y){
	_x = x;
	_y = y;
}

Point:: Point(const Point &from) {
      _x = from._x;
      _y = from._y;
    }


Point:: ~Point() {}

void Point:: set(double x, double y)
{
	_x = x;
	_y = y;
}

double Point:: getx(){
	return _x;
}


double Point:: gety(){
	return _y;
}

double Point:: sum(){
	return (_x + _y);
}

double Point:: avg(){
	double sumpoints = sum();
	return (sumpoints/2);
}

Point Point:: add(const Point &p)
{
	double x = p._x + _x;
	double y = p._y + _y;
	return Point(x,y);
}

void Point:: isequal(const Point &p)
{
	if((p._x == _x) && (p._y == _y))
	{
	   cout <<  "true" << endl;
	}
	else { cout <<  "false" << endl; }
}

void Point:: printpoint()
{
	cout <<  "x=" << _x << ", y=" << _y << endl;
}


