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

        

    }

}

 

相关文章:

  • 2021-09-05
  • 2022-12-23
  • 2021-06-30
  • 2021-11-27
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
猜你喜欢
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-11-27
  • 2021-11-27
相关资源
相似解决方案