package ch05_16;
import ch05_15.Point;
public class TestMain16 {
	public static void main(String[] args) {
		Point p1,p2;  //声明两个点；
		double d1;   //存放两点之间的距离变量
		p1=new Point(1,1);
		p2=new Point(10,10);
		d1=p1.distance(p2);
		System.out.println("p1点的坐标为：("+p1.getX()+","+p1.getY()+")");
		System.out.println("p2点的坐标为：("+p2.getX()+","+p2.getY()+")");
		System.out.println("两点距离为为："+d1);
		Point p3,p4;//声明两个点；
		double d2;//存放两点之间的距离变量
		p3=p1;
		p4=p2;
		d2=p3.distance(p4);
		System.out.println("p3点的坐标为：("+p3.getX()+","+p3.getY()+")");
		System.out.println("p4点的坐标为：("+p4.getX()+","+p4.getY()+")");
		System.out.println("两点距离为为："+d2);
		String out="重新设置p3的坐标值，然后再输出点p1、p2以及p3、p4之间的距离值！";
		System.out.println(out);
		p3.setX(-1);
		p3.setY(-1);
		d1=p1.distance(p2);
		System.out.println("p1点的坐标为：("+p1.getX()+","+p1.getY()+")");
		System.out.println("p2点的坐标为：("+p2.getX()+","+p2.getY()+")");
		System.out.println("两点距离为为："+d1);
		d2=p3.distance(p4);
		System.out.println("p3点的坐标为：("+p3.getX()+","+p3.getY()+")");
		System.out.println("p4点的坐标为：("+p4.getX()+","+p4.getY()+")");
		System.out.println("两点距离为为："+d2);
	}
}
