package b; public interface ZuoBiao {
double zuobiao(); }
package b; public class Point implements ZuoBiao {
double x;
double y;
double z; public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
public double zuobiao() {
System.out.println("显示坐标 "+"("+x+","+y+","+z+")");
return 0; }
public void yuandianjuli()
{
System.out.println("距原点的距离:"+Math.sqrt(z*z+Math.sqrt(x*x+y*y)*Math.sqrt(x*x+y*y)));
} }
package b; public class TestZuoBiao { public static void main(String[] args) {
Point xyz=new Point();
xyz.setX(3.0);
xyz.setY(4.0);
xyz.setZ(6.0);
xyz.zuobiao();
xyz.yuandianjuli(); } }