Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Point {
- private double x;
- private double y;
- public Point() {
- this.x = 0;
- this.y = 0;
- }
- Point(double x, double y) {
- this.x = x;
- this.y = y;
- }
- public void print() {
- System.out.println("Point(x: " + x + " y: " + y + ")");
- }
- public void set(double x, double y) {
- this.x = x;
- this.y = y;
- }
- public double length(Point p) {
- return Math.pow(Math.abs(this.x - p.x), 2) + Math.pow(Math.abs(this.y - p.y), 2);
- }
- public void move(double a, double b) {
- this.x += a;
- this.y += b;
- }
- public boolean equalsPoint(Point p) {
- return (this.x == p.x) && (this.y == p.y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement