Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Point {
- private int x;
- private int y;
- public Point() {
- }
- public Point(int x, int y) {
- this.x = x;
- this.y = y;
- }
- public int getX() {
- return x;
- }
- public void setX(int x) {
- this.x = x;
- }
- public int getY() {
- return y;
- }
- public void setY(int y) {
- this.y = y;
- }
- public double distance (Point m){
- return distance(m.getY(), m.getY());
- }
- public double distance ( int a , int b){
- return (Math.sqrt((this.x - b) * ( this.x-a) + (this.y -b) * (this.y - b)));
- }
- public double distance (){
- return distance(0,0);
- }
- }
Add Comment
Please, Sign In to add comment