Advertisement
binibiningtinamoran

Point

Oct 8th, 2019
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. public class Point {
  2.  
  3.     private int x, y;
  4.     private final int DEFAULT_X = 1;
  5.     private final int DEFAULT_Y = 1;
  6.  
  7.  
  8.     public Point() {
  9.         this.x = DEFAULT_X;
  10.         this.y = DEFAULT_Y;
  11.     }
  12.  
  13.     public Point(int x, int y) {
  14.         this.x = x;
  15.         this.y = y;
  16.     }
  17.     public Point(Point p) {
  18.         this.x = p.x;
  19.         this.y = p.y;
  20.     }
  21.     public int getX() {
  22.         return x;
  23.     }
  24.     public int getY() {
  25.         return y;
  26.     }
  27.     public void set(int x, int y) {
  28.         this.x = x;
  29.         this. y = y;
  30.     }
  31.     /* WHAT IS THE POINT OF THESE METHODS???
  32.     public double distance(Point p) {
  33.  
  34.     }
  35.     public double getDistance(Point p) {
  36.  
  37.     }
  38.      */
  39.  
  40.     @Override
  41.     public String toString() {
  42.         return "Point(" + x + ", " + y + ")";
  43.     }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement