选择题:阅读以下说明和Java程序,将应填入(n)处的字句写在对应栏内 [说明] 以下程序的功能时三角形、矩

  • 题目分类:软考初级
  • 题目类型:选择题
  • 查看权限:VIP
题目内容:
阅读以下说明和Java程序,将应填入(n)处的字句写在对应栏内

[说明]

以下程序的功能时三角形、矩形和正方形的面积输出。

程序由5个类组成:areatest是主类,类Triangle,Rectangle和Square分别表示三角形、矩形和正方形,抽象类Figure提供了一个计算面积的抽象方法。

[Java程序]

public class areatest {

public static viod main(string args[]){

Figure[]Figures={

New triangle(2,3,3),new rectangle(5,8),new square(5)

};

for(int i=0; i<Figures.length;i++){

system.out.println(Figures+"area="+Figures.getarea());

}

}

}

public abstract class figure {

public abstract double getarea();

}

public class rectangle extends (1) {

double height;

double width;

public rectangle (double height,double width){

this.height=height;

this.width=width;

}

public string tostring(){

return"rectangle:height="+height+",width="+width+":";

}

public double getarea(){

return (2)

}

}

public class square exends (3)

{

public square(double width){

(4);

}

public string tostring(){

return"square:width="+width":";

}

}

public class triangle entends (5)

{

double la;

double lb;

double lc;

public triangle(double la,double lb,double lc){

this.la=la;this.lb=lb;this.lc=lc;

}

public string tostring()(

return"triangle:sides="+la+","+lb+","+lc+":";

}

public double get area(){

double s=(la+lb+lc)/2.0;

return math.sqrt(s*(s-la)*(s-lb)*(s-lc));

}

}




参考答案:

根据下面给出的一个VLAN的实例,回答问题。 某IT公司现有行政部、技术部、市场部。VUN的划分:行政部VL

根据下面给出的一个VLAN的实例,回答问题。 某IT公司现有行政部、技术部、市场部。VUN的划分:行政部VL

查看答案

先阅读以下说明,然后将空白处的语句补充完整。 [说明] 以下是HTML语言的部分代码,其中,符号“//”表

先阅读以下说明,然后将空白处的语句补充完整。 [说明] 以下是HTML语言的部分代码,其中,符号“//”表

查看答案

阅读下列函数说明和C函数,将应填入______处的语句写在答题纸的对应栏内。 [函数6说明] 函数DelA_I

阅读下列函数说明和C函数,将应填入______处的语句写在答题纸的对应栏内。 [函数6说明] 函数DelA_I

查看答案

● In C language, a ___(67)___ is a series of characters enclosed in double quotes. (67)A.

● In C language, a ___(67)___ is a series of characters enclosed in double quotes. (67)A.

查看答案

● 下面的图像格式中, (12) 不支持透明控制信息。 (12)A.GIF B.PNG C.PSD D.JPG

● 下面的图像格式中, (12) 不支持透明控制信息。 (12)A.GIF B.PNG C.PSD D.JPG

查看答案