Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Punto {
- private final double x;
- private final double y;
- public Punto() {x = 0.0; y = 0.0;}
- public Punto(double x, double y) {this.x = x;this.y = x; }
- public double x() { return x; }
- public double y() { return y; }
- public double distanzaDa(Punto p) {
- double dx = this.x() - x();
- double dy = this.y() - y();
- return Math.sqrt(dx*dx + dy*dy);
- }
- public String toString() { return "(" + x + ", " + y + "}"; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement