You are on page 1of 2

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace cshw2
{
internal class Point
{
public int x;
public int y;

public Point(int x, int y)


{
this.x = x;
this.y = y;
}

public int Quadrant()


{
if (x == 0 || y == 0)
{
return 0;
}
else if (x > 0)
{
if (y > 0)
{
return 1;
}
else
{
return 4;
}
}
else
{
if (y > 0)
{
return 2;
}
else
{
return 3;
}

}
}
public double DistanceFrom(Point p)
{
int x_dist = this.x - p.x;
int y_dist = this.y - p.y;
return Math.Sqrt((x_dist)^2 + (y_dist)^2);
}
public double DistanceFromOrigin()
{
return Math.Sqrt(x * x + y * y);
}
}

You might also like