mirror of
https://github.com/RustyRaptor/Programs.git
synced 2026-12-03 15:45:21 -07:00
reversed the order of x and y in the constructor for Circle2 to fix failed test
This commit is contained in:
1 parent
5a0a1d5da9
commit
a9b2867f67
2 files changed
+14
-17
No files matched your search
@@ -53,7 +53,7 @@ public abstract class Circle
|
||||
public Point moveBy(double xOffset, double yOffset)
|
||||
{
|
||||
center.x = center.x + xOffset;
|
||||
center.y = center.y + xOffset;
|
||||
center.y = center.y + yOffset;
|
||||
return center;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
package edu.nmsu.cs.circles;
|
||||
|
||||
public class Circle2 extends Circle
|
||||
{
|
||||
public class Circle2 extends Circle {
|
||||
|
||||
public Circle2(double x, double y, double radius)
|
||||
{
|
||||
super(y, x, radius);
|
||||
}
|
||||
public Circle2(double x, double y, double radius) {
|
||||
super(x, y, radius);
|
||||
}
|
||||
|
||||
public boolean intersects(Circle other)
|
||||
{
|
||||
double d;
|
||||
d = Math.sqrt(Math.pow(center.x - other.center.x, 2) +
|
||||
Math.pow(center.y - other.center.y, 2));
|
||||
if (d < radius)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public boolean intersects(Circle other) {
|
||||
double d;
|
||||
d = Math.sqrt(Math.pow(center.x - other.center.x, 2) +
|
||||
Math.pow(center.y - other.center.y, 2));
|
||||
if (d < radius)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user