定义一个“点”(Point)类用来表示三维空间中的点(有三个坐标)。要求如下: (1)可以生成具有特定坐标的点对象。 (2)提供可以设置三个坐标的方法。 (3)提供可以计算该“点”距原点距离平方的方法。 (4)编写主类程序验证。

package b;

public interface ZuoBiao {
    double zuobiao();

}




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();

        

    }

}