二次作业3

来源:互联网 发布:java聊天室项目 编辑:程序博客网 时间:2024/06/05 18:44
package test;
public class Point {
    double x ,y,Circle;
    public Point() {
 this.x=1.0;
 this.y=2.0;
 this.Circle=3.0;
 }
   
 public Point(double x, double y, double circle) {
  this.x = x;
  this.y = y;
  Circle = circle;
 }
 public boolean overlap(Point p) {
        return Math.sqrt((p.x-this.x)*(p.x-this.x)+(p.y-this.y)*(p.y-this.y))<(p.Circle+this.Circle);
    }
 public static void main(String[] args) {
  // TODO Auto-generated method stub
    Point c1=new Point();
    Point c2=new Point(3.0,4.0,5.0);
    System.out.println(c1.overlap(c2));
 }
}
原创粉丝点击