SHARE
TWEET

Untitled

a guest Jan 24th, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Point {
  2.     double x;
  3.     double y;
  4.  
  5.     Point(double x, double y) {
  6.         this.x = x;
  7.         this.y = y;
  8.     }
  9.  
  10.     double calculateDistance(Point point) {
  11.         return Math.sqrt(Math.pow(this.x - point.x, 2) + Math.pow(this.y - point.y, 2));
  12.     }
  13.  
  14.     void moveCloser(Point referencePoint, double ratio) {
  15.         this.x = this.x + (referencePoint.x - this.x) * ratio;
  16.         this.y = this.y + (referencePoint.y - this.y) * ratio;
  17.     }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top