mramine364

point.java

Jan 6th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1.  
  2. package compute;
  3.  
  4.  
  5. public class point{
  6. public double x, y;
  7. public int id;
  8.  
  9. public point(int id, double x, double y) {
  10. this.x = x;
  11. this.y = y;
  12. this.id = id;
  13. }
  14.  
  15. public point(point p) {
  16. this(p.id, p.x, p.y);
  17. }
  18.  
  19. public static double dist(point a, point b){
  20. return Math.sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
  21. }
  22.  
  23. @Override
  24. public String toString(){
  25. return "point("+id+")=["+x+", "+y+"]";
  26. }
  27. }
Add Comment
Please, Sign In to add comment