i have bug that i cannot find, i have Class Point with method who receive other point and return true if my point is under the other poing and false if not, my problem is if my point x property is equal to other point x i still received true which is incorrect:
public class Point
{
private double _x;
private double _y;
public Point(double x,double y)
{
_x = x;
_y = y;
}
public boolean isAbove(Point other)
{
if (_x > other._x)
{
return true;
}
else
{
return false;
}
}
public boolean isUnder(Point other)
{
if (isAbove(other))
{
return false;
}
else
{
return true;
}
}
}
Try that:
Why you had a bug: because the opposite of
A < BisA >= B, notA > B.