Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import java.lang.Math;
  2. public class Point
  3. {
  4. //constructor
  5. Point (int x1, int y1)
  6. {
  7. x = x1;
  8. y = y1;
  9. }
  10.  
  11. //Sets new point coordinates
  12. public void setPoint(int num1, int num2)
  13. {
  14. x = num1;
  15. y = num2;
  16. }
  17.  
  18. //returns x-coordinate of point
  19. public int getX()
  20. {
  21. return x;
  22. }
  23.  
  24. //returns y-coordinate of Point
  25. public int getY()
  26. {
  27. return y;
  28. }
  29.  
  30. //returns the distance this point is from the point (0, 0)
  31. public double getDistanceFromOrigin()
  32. {
  33. int distance;
  34. distance = Math.sqrt(((x * x) + (y * y));
  35. }
  36. public static point findFarPoint(Point p1, Point p2, Point p3)
  37. {
  38. if (p1 >= p2)
  39.  
  40. }
  41.  
  42. private int x; //x-coordinate of point
  43. private int y; //y-coordinate of point
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement