皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
定义Point3D类,用于描述三维空间中的一个点,要求如下: (1)使Point3D类继承自上一题中定义的Point类,并增加一个字段,保存z坐标值。 (2)为Point3D类配置一个三参数的构造方法,对x、y、z坐标进行初始化。其中,x和y的值通过调用父类的构造方法完成。同时,显式定义Point3D类的无参构造方法,将点设置在坐标原点。 (3)为Point3D类定义一个计算该点到空间另一点间距离的方法distance3D,参数为空间另一个点。 (4)在Point3D类中添加一个main方法,计算并输出(0,0,0)点和(2,2,2)点之间的距离。 Point3D类的代码如下,请将程序补充完整,并在计算机上运行。 public class Point3D 【1】 { //指定父类 【2】 ; //增加成员变量z public Point3D() { 【3】 ; //调用三个参数的构造方法 } public Point3D(int x,int y,int z) //定义三个参数的构造方法 { ; //调用父类的构造方法 this.z=z; } 【5】 //distance3D方法头 { double d; 【6】 ; //计算空间两点间的距离 return d; } public static void main(String[] args) { 【7】 ; //调用无参构造函数,创建p1对象,表示空间原点 【8】 ; //创建p2对象,表示空间点(3,4,5) double dist; dist= 【9】 ; //求p1和p2点之间的距离 System.out.println("空间距离为:"+dist); } } 该程序的运行结果,dist= 【10】 //写出出的dist的值
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【多选题】实验中,关于称取镁条的质量,下列说法正确的是( )。
A.
镁条的质量少,称量误差大,产生的氢气少,读数误差也大,测定结果不准确
B.
镁条的质量多,产生的氢气过多,会导致量气管无法读数
C.
以产生30 mL左右的氢气来称取镁条的质量为宜
D.
以产生近50 mL的氢气来称取镁条的质量,这样称量误差和读数误差都更小
【简答题】K型热电偶的长期测量温度为( ),短期测量温度为( )
【单选题】According to the passage, the declarative memories could be
A.
affected by the memory of general facts and specific events.
B.
determined by some specific structures in the brain.
C.
expressed as changes to the structure and function of neurons.
D.
communicated to create new connections of neurons.
【单选题】以下哪项不是描述紧张的形容词( )
A.
惴惴不安
B.
恐慌
C.
坐立不安
D.
紧张的
E.
心神不宁
【单选题】开行调试列车的命令由( )发布
A.
电力调度
B.
环控调度
C.
行车调度
D.
防灾调度
【单选题】蛋白质最常见的二级结构模式是:
A.
α 螺旋
B.
β 折叠
C.
β 螺旋
D.
β 转角
E.
不规则卷曲
【简答题】D Here are a few tips we’ve put together to help you learn English well. Speak, speak, speak! Practise speaking as often as you can—even speaking to yourself is good practice. Try recording yourself w...
【单选题】开行调试列车的命令由( )发布。
A.
行车调度
B.
电力调度
C.
环控调度
D.
防灾调度
【简答题】A.speak B.have C.link D.put
【单选题】According to the law of that country, the Parliament will have to be ______ before the General Election.
A.
decomposed
B.
dispersed
C.
dissolved
D.
disintegrated
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题