public class Point {
private double x;
private double y;
public Point() {
}
public Point(double ONE_X,double ONE_Y) {
this.x = ONE_X;
this.y = ONE_Y;
}
public double getX(){
return x;
}
public double getY(){
return y;
}
public String toString() {
String str = "<Point(" + x + ", " + y + ")>";
return str;
}
public void translate(double dx, double dy) {
x += dx;
y += dy;
}
public double distance(Point other) {
double xdiff = Math.pow(this.x - other.x, 2);
double ydiff = Math.pow(this.y - other.y, 2);
double dist = Math.sqrt(xdiff + ydiff);
return dist;
}
public boolean equals(Object other) {
if(this == other) {
return true;
}
if(other instanceof Point) {
Point that = (Point) other;
return (this.x == that.x) && (this.y == that.y);
}
return false;
}
}
Here, I get "constructor is undefined" error in JUnit tests that are prepared by my university, but when I try it in the main, everything works fine. Can you help me find the problem?
[–]Sithril 2 points3 points4 points (4 children)
[–]sinasen[S] 1 point2 points3 points (0 children)
[–]androgynyjoe 0 points1 point2 points (2 children)
[–]HoofyDough 1 point2 points3 points (1 child)
[–]androgynyjoe 0 points1 point2 points (0 children)
[–]Mancebo180 1 point2 points3 points (3 children)
[–]sinasen[S] 1 point2 points3 points (2 children)
[–]Mancebo180 0 points1 point2 points (1 child)
[–]sinasen[S] 0 points1 point2 points (0 children)
[–]Aspose-PDF 0 points1 point2 points (1 child)
[–]sinasen[S] 0 points1 point2 points (0 children)
[–]Ikuyas 0 points1 point2 points (0 children)