Class Point ok

This commit is contained in:
JunkJumper 2020-05-22 15:57:35 +02:00
parent 5b85b9adec
commit 743328301d
2 changed files with 16 additions and 11 deletions

View File

@ -1,5 +1,11 @@
package TD1.point; package TD1.point;
/********************************************************************************************
* @author JunkJumper *
* @license https://creativecommons.org/licenses/by/4.0/ License CC BY 4.0 *
* @since File available since 20/05/2020 *
********************************************************************************************/
public class MainTestPoint { public class MainTestPoint {
public static void main(String[] args) public static void main(String[] args)
{ {
@ -106,5 +112,6 @@ public class MainTestPoint {
} }
} }

View File

@ -1,5 +1,11 @@
package TD1.point; package TD1.point;
/********************************************************************************************
* @author JunkJumper *
* @license https://creativecommons.org/licenses/by/4.0/ License CC BY 4.0 *
* @since File available since 20/05/2020 *
********************************************************************************************/
public class Point public class Point
{ {
private double x; private double x;
@ -43,23 +49,15 @@ public class Point
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
Point p = (Point)obj; Point p = (Point)obj;
if (this.x == p.x && this.y == p.y) { return (this.x == p.x && this.y == p.y);
return true;
} else {
return false;
}
} }
public Point clone() { public Point clone() {
return this; return this;
} }
public void displayLocation() { public String displayLocation() {
System.out.println("x = " + this.getX() + " , y = " + this.getY() + "."); return "x = " + this.getX() + " , y = " + this.getY();
}
public Point getLocation() {
return this;
} }
public void setLocation(Point p) { public void setLocation(Point p) {