java一个程序出错,请求帮助!!!

下面是一个JAVA的程序,我是一个初学者,不知道其代码表示的意思,而且还有几个错误问题,请高手能够指点错误所在及其解决办法,最后还要请求高手把每句代码的意思标注上来,谢谢... 下面是一个JAVA的程序,我是一个初学者,不知道其代码表示的意思,而且还有几个错误问题,请高手能够指点错误所在及其解决办法,最后还要请求高手把每句代码的意思标注上来,谢谢...

class Point
{
private double x;
private double y;
Point (double x1 , double y1)
{
x=x1;
y=y1;
}
public double getx()
{
return x;
}
public double gety()
{
return y;
}
public void setx(double i)
{
x=i;
}
public void sety(double i)
{
y=i;
}
}
class circle
{
private Point o;
private double radius;

circle(Point p,double r)
{
o=p;
radius=r;
}

circle(double r)
{
o=new Point (0.0,0.0);
radius=r;
}

boolean contain(Point p)
{
double x=p.getx()-o.getx();
double y=p.gety()-o.gety();
if(x*x+y*y>radius*radius)return false;
else return true;

}

public void seto(double x,double y)
{
o.setx(x);
o.sety(y);
}

public Point get()
{
return o;
}

public double getradius()
{
return radius;
}

public void steradius(double r)
{
radius=r;
}

public double area()
{
return 3.14*radius*radius;
}
}

public class Testcircle
{
public static void main(String[] args)
{
circle c1 = new circle(new Point(1.0,2.0),2.0);
circle c2 = new circle(5.0);

System.out.println("c1:("+c1.geto().getx()+","
+c1.geto().gety()+"),"+c1.getradius());

System.out.println("c2:("+c2.geto().getx()+","
+c2.geto().gety()+"),"+c2.getradius());

System.out.println("c1 area="+c1.area());

System.out.println("c1 area="+c2.area());

c1.steo(5,6);
c2.steradius(9.0);

System.out.println("c1:("+c1.geto().getx()+","
+c1.geto().gety()+"),"+c1.getradius());

System.out.println("c2:("+c2.geto().getx()+","
+c2.geto().gety()+"),"+c2.getradius());

System.out.println("c1 area="+c1.area());

System.out.println("c1 area="+c2.area());

Point p1=new Point(5.2,6.3);

System.out.println(c1.contains(p1));
System.out.println(c1.contains(new Point(10.0,9.0)));
}
}
展开
 我来答
waca408
2008-07-11 · 超过14用户采纳过TA的回答
知道答主
回答量:117
采纳率:0%
帮助的人:61万
展开全部
太马虎了,我把正确的以更改过来了的,运行成功的
class Point
{
private double x;
private double y;
Point (double x1 , double y1)
{
x=x1;
y=y1;
}
public double getx()
{
return x;
}
public double gety()
{
return y;
}
public void setx(double i)
{
x=i;
}
public void sety(double i)
{
y=i;
}
}
class circle
{
private Point o;
private double radius;

circle(Point p,double r)
{
o=p;
radius=r;
}

circle(double r)
{
o=new Point (0.0,0.0);
radius=r;
}

boolean contain(Point p)
{
double x=p.getx()-o.getx();
double y=p.gety()-o.gety();
if(x*x+y*y>radius*radius)return false;
else return true;
}

public void seto(double x,double y)
{
o.setx(x);
o.sety(y);
}

public Point geto()
{
return o;
}

public double getradius()
{
return radius;
}

public void setradius(double r)
{
radius=r;
}

public double area()
{
return 3.14*radius*radius;
}
}

class Testcircle
{
public static void main(String[] args)
{
circle c1 = new circle(new Point(1.0,2.0),2.0);
circle c2 = new circle(5.0);

System.out.println("c1:("+c1.geto().getx()+","
+c1.geto().gety()+"),"+c1.getradius());

System.out.println("c2:("+c2.geto().getx()+","
+c2.geto().gety()+"),"+c2.getradius());

System.out.println("c1 area="+c1.area());

System.out.println("c1 area="+c2.area());

c1.seto(5.0,6.0);
c2.setradius(9.0);

System.out.println("c1:("+c1.geto().getx()+","
+c1.geto().gety()+"),"+c1.getradius());

System.out.println("c2:("+c2.geto().getx()+","
+c2.geto().gety()+"),"+c2.getradius());

System.out.println("c1 area="+c1.area());

System.out.println("c1 area="+c2.area());

Point p1=new Point(5.2,6.3);

System.out.println(c1.contain(p1));
System.out.println(c1.contain(new Point(10.0,9.0)));
}
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
pa...4@qq.com
2008-07-11 · TA获得超过556个赞
知道小有建树答主
回答量:462
采纳率:0%
帮助的人:284万
展开全部
“c1.geto().getx()”circle这个类里有“geto()”这个方法?
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
rrrjatvtk
2008-07-11
知道答主
回答量:50
采纳率:0%
帮助的人:0
展开全部
这是一个类
class Point
{
private double x; //定义变量
private double y; //定义变量
Point (double x1 , double y1) //这是个构造方法,定义两个形参
{
x=x1; //用形参给上面的变量赋值
y=y1;
}
//这是两个方法,用来返回x.y的值
public double getx()
{
return x;
}
public double gety()
{
return y;
}
//这是两个方法,用来设置x,y的值。
public void setx(double i)
{
x=i;
}
public void sety(double i)
{
y=i;
}
}
class circle
{
private Point o;
private double radius;

circle(Point p,double r)
{
o=p;
radius=r;
}

circle(double r)
{
o=new Point (0.0,0.0);
radius=r;
}

boolean contain(Point p)
{
double x=p.getx()-o.getx();
double y=p.gety()-o.gety();
if(x*x+y*y>radius*radius)return false;
else return true;

}

public void seto(double x,double y)
{
o.setx(x);
o.sety(y);
}

public Point get()
{
return o;
}

public double getradius()
{
return radius;
}

public void steradius(double r)
{
radius=r;
}

public double area()
{
return 3.14*radius*radius;
}
}

public class Testcircle
{
//主函数
public static void main(String[] args)
{
circle c1 = new circle(new Point(1.0,2.0),2.0); 建成一个新的对像,给方法赋值
circle c2 = new circle(5.0);

System.out.println("c1:("+c1.geto().getx()+","
+c1.geto().gety()+"),"+c1.getradius());

System.out.println("c2:("+c2.geto().getx()+","
+c2.geto().gety()+"),"+c2.getradius());

System.out.println("c1 area="+c1.area());

System.out.println("c1 area="+c2.area());

c1.steo(5,6);
c2.steradius(9.0);

System.out.println("c1:("+c1.geto().getx()+","
+c1.geto().gety()+"),"+c1.getradius());

System.out.println("c2:("+c2.geto().getx()+","
+c2.geto().gety()+"),"+c2.getradius());

System.out.println("c1 area="+c1.area());

System.out.println("c1 area="+c2.area());

Point p1=new Point(5.2,6.3);

System.out.println(c1.contains(p1));
System.out.println(c1.contains(new Point(10.0,9.0)));
}
}

大哥呀,你真的是初学者的初学者啊,自己看吧,我是写不行了。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式