JAVA中如何用函数来对地理坐标点的匹配?
答案:1 悬赏:70 手机版
解决时间 2021-03-31 05:20
- 提问者网友:放下
- 2021-03-30 08:04
JAVA中如何用函数来对地理坐标点的匹配?
最佳答案
- 五星知识达人网友:舊物识亽
- 2021-03-30 09:41
class LocPoint
{
private double x,y;
public LocPoint(double x,double y)
{
if(x>=0&&y>=0)
{
this.x=x;
this.y=y;
}
else
{
System.out.println("输入的坐标有误");
}
}
public boolean getlocation()
{
if((double)(Math.sqrt((this.x-112.32)*(this.x-112.32)+(this.y-54.3)*(this.y-54.3)))<0.01)
return true;
else
return false;
}
}
public class Test1
{
public static void main(String[] args)
{
LocPoint[] a=new LocPoint[2];
a[0]=new LocPoint(112.32,54.3);
a[1]=new LocPoint(450,200);
for(int i=0;i {
boolean b=a[i].getlocation();
if(b)
System.out.println("是同一点");
else
System.out.println("不是同一点");
}
}
}
{
private double x,y;
public LocPoint(double x,double y)
{
if(x>=0&&y>=0)
{
this.x=x;
this.y=y;
}
else
{
System.out.println("输入的坐标有误");
}
}
public boolean getlocation()
{
if((double)(Math.sqrt((this.x-112.32)*(this.x-112.32)+(this.y-54.3)*(this.y-54.3)))<0.01)
return true;
else
return false;
}
}
public class Test1
{
public static void main(String[] args)
{
LocPoint[] a=new LocPoint[2];
a[0]=new LocPoint(112.32,54.3);
a[1]=new LocPoint(450,200);
for(int i=0;i {
boolean b=a[i].getlocation();
if(b)
System.out.println("是同一点");
else
System.out.println("不是同一点");
}
}
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯