聚合度(DP、X n)
聚合度(DP、X n)
相关考题:
阅读以下函数说明和Java代码,将应填入(n)处的字句写在对应栏内。【说明】现要编写一个画矩形的程序,目前有两个画图程序:DP1和DP2,DP1用函数draw_a_line(x1,y1,x2,y2)画一条直线,DP2则用drawline(x1,x2,y1,y2)画一条直线。当实例画矩形时,确定使用DP1还是DP2。为了适应变化,包括“不同类型的形状”和“不同类型的画图程序”,将抽象部分与实现部分分离,使它们可以独立地变化。这里,“抽象部分”对应“形状”,“实现部分”对应“画图”,与一般的接口(抽象方法)与具体实现不同。这种应用称为Bridge(桥接)模式。图9-6显示了各个类间的关系。这样,系统始终只处理3个对象:Shape对象、Drawing对象、DP1或DP2对象。以下是 Java语言实现,能够正确编译通过。【Java代码】//DP1.java文件public class DP1{static public void draw_a line(double x1,double y1,double x2,double y2){//省略具体实现}}//DP2.java文件public class DP2{static public void drawline(double x1,double y1,double x2,double y2){//省略具体实现}}//Drawing.java文件(1) public class Drawing{abstract public void drawLine(double x1, double y1, double x2, double y2);}//V1Drawing.java文件public class V1Drawing extends Drawing{public void drawLine(double x1, double y1, double x2, double y2){DP1.draw_a_line(x1,y1,x2,y2);}}//V2Drawing.java文件public class V2Drawing extends Drawing{public void drawLine(double x1,double y1,double x2, double y2)(//画一条直线(2);}}//Shape.java文件abstract public class Shape{abstract public void draw();private (3) _dp;Shape(Drawing dp){_dp=dp;}protected void drawLine(double x1,double y1,double x2, double y2){(4);}}//Rectangle.java文件public class Rectangle extends Shape{private double_x1,_x2,_y1,_y2;public Rectangle(Drawing dp,double x1,double y1,double x2,double y2){(5);_x1=x1;_x2=x2;_y1=y1;_y2=y2;}public void draw(){//省略具体实现}}
阅读以下说明和C++代码,[说明]现要编写一个画矩形的程序,目前有两个画图程序:DP1和DP2,DP1用函数draw_a_line(x1,y1,x2,y2)画一条直线,DP2则用drawline(x1,x2,y1,y2)画一条直线。当实例化矩形时,确定使用DP1还是DP2。为了适应变化,包括“不同类型的形状”和“不同类型的画图程序”,将抽象部分与实现部分分离,使它们可以独立地变化。这里,“抽象部分”对应“形状”,“实现部分”对应“画图”,与一般的接口(抽象方法)与具体实现不同。这种应用称为Bridge(桥接)模式。图6-1显示了各个类间的关系。[图6-1]这样,系统始终只处理3个对象:Shape对象、Drawingg对象、DP1或DP2对象。以下是C++语言实现,能够正确编译通过。[C++代码]class DP1{public:static void draw_a_line(double x1,double y1,double x2,double y2){//省略具体实现}};class DP2{public:static void drawline(double x1,double x2,double y1,double y2){//省略具体实现}};class Drawing{public:(1) void drawLine(double x1,double y1,double x2,double y2)=0;};class V1Drawing:public Drawing{public:void drawLine(double x1,double y1,double x2,double y2){DP1::draw_a_line(x1,y1,x2,y2);}};class V2Drawing:public Drawing{public:void drawLine(double x1,double y1,double x2,double y2){(2)}};class Shape{privatc:(3) dp;public:Shape(Drawing*dp);virtual void draw()=0;void drawLine(double x1,double y1,double x2,double y2);};Shape::Shape(Drawing*dp){_dp=dp;}void Shape::drawLine(double x1,double y1,double x2,double y2){ //画一条直线(4);}class Rectangle:public Shape{privatc:double_x1,_y1,_x2,_y2;public:Rectangle(Drawing *dp,double x1,double y1,double x2,double y2);void draw();};Rectangle::Rectangle(Drawing*dp,double x1,double y1,double x2,double y2): (5){_x1=x1;_y1=yl;_x2=x2;_y2=y2;}void Rectangle::draw(){//省略具体实现}(1)
有以下程序:include main( ) { int m,n,p;seanf( "m = % dn = % dp = % d", m, seanf( "m = % dn = % dp = % d", m, n,p) printf( "% d% d% d \n", m, n, p); } 若想从键盘上输入数据,使变量m中的值为123,n中的值为456, p中的值为789,则下列选项中正确的输入是( )。A.m = 123n =456p =789B.m = 123 n =456 p =789C.m= 123,n =456,p =789D.123 456 789
下列程序的输出结果是______。 int t(int x,int y,int cp,int dp) { cp=x*X+y*y; dp=x*x-y*y; } main() { int a=4,b=3,c=5,d=6: t(a,b,c,d); printf("%d%d\n" ,c,d);A.4 5B.4 6C.5 6D.5 5
下列程序的输出结果是( )。int t(int x,int y,int cp,int dp){cp=x% y+y*y;dp=x+x-y*y;}main(){ im a=4,b=3,c=9,d=8;t(a,b,c,D);printf("%d%d\n",c,D);}
阅读以下说明和c++代码,将应填入(n)处的字句写在对应栏内。【说明】现要编写一个画矩形的程序,目前有两个画图程序:DP1和DP2,DP1用函数draw_a_line(x1, y1,x2,y2)画一条直线,DF2则用drawline(x1,x2,y1,y2)画一条直线。当实例画矩形时,确定使用DP1还是DP2。为了适应变化,包括“不同类型的形状”和“不同类型的画图程序”,将抽象部分与实现部分分离,使它们可以独立地变化。这里,“抽象部分”对应“形状”,“实现 部分”对应“画图”,与一般的接口(抽象方法)与具体实现不同。这种应用称为Bridge(桥接)模式。图9-7显示了各个类间的关系。这样,系统始终只处理3个对象:Shape对象、Drawing对象、DP1或DP2对象。以下是 C++语言实现,能够正确编译通过。【C++代码】class DP1{public:static void draw_a_line(double x1, double y1,double x2, double y2){//省略具体实现});class DP2{public:static void drawline(double x1, double x2,double y1, double y2){//省略具体实现}};class Drawing{public:(1) void drawLine(double x1,double y1,double x2,double y2)=0;};class V1Drawing:public Drawing{public:void drawLine(double x1, double y1,double x2, double y2){DP1::draw_a_line(x1,y1,x2,y2);}};class V2Drawing:public Drawing{public:void drawLine(double x1, double y1, double x2, double y2){(2);}};class Shape{private:(3) _dp;public:Shape(Drawing *dp);virtual void draw()=0;void drawLine(double x1, double y1, double x2, double y2);};Shape::Shape(Drawing *dp){_dp = dp;}void Shape::drawLine(double x1, double y1, double x2, double y2){ //画一条直线(4);}class Rectangle: public Shape{private:double _x1,_y1,_x2,_y2;public:Rectangle(Drawing *dp, double x1, double y1,double x2, double y2);void draw();};Rectangle::Rectangle(Drawing *dp, double x1, double y1, double x2, double y2):(5){_x1=x1;_y1=y1;_x2=x2;_y2=y2;}void Rectangle::draw(){//省略具体实现}
下列程序的输出结果是______。 int fun(int x,int y,int*cp,int*dp) { *cp=x+y; *dp=x-y; } main() { int a, b, c, d; a=30;b=50; fun(a,b,c,d); printf("%d,%d\n", c, d); }A.50,30B.30,50C.80,-20D.80,20
单选题设两个相互独立的随机变盘X和Y分别服从于N(0,1)和N(1,12),则( ).AP{X+Y≤0}=1/2BP{X+Y≤1}=1/2CP{X-Y≤0}=1/2DP{X-Y≤1}=1/2
单选题若某人群某疾病发生的阳性数X服从二项分布,则从该人群中随机抽出n个人,阳性数X不少于k人的概率为()。AP(k+1)+P(k+2)+…+P(n)BP(0)+P(1)+…+P(k)CP(0)+P(1)+…+P(k+1)DP(k)+P(k+1)+…+P(n)EP(1)+P(2)+…+P(k)
多选题设随机变量X仅取n个值x1, x2,… xn,其概率函数为P(X=xi)=pi,则( )。A-1≦pi≦1,i=1,2…,nBpi≧0,i=1,2,…,nCp1+p2+…+Pn≦1Dp1+p2+…+Pn=1
多选题正态分布N(10,1)的0.8分位数u0.8满足( )。AP(X>u0.8)=0.2BP((X-10)≤u0.8)=0.8CP(X≤u0.8)=0.8DP((X-10)>u0.8)=0.2EP((X-10)≥u0.8)=0.2
单选题设X~N(2,22),其概率密度函数为f(x),分布函数F(x),则( )。AP{X≤0}=P{X≥0}=0.5Bf(-x)=1-f(x)CF(x)=-F(-x)DP{X≥2}=P{X<2}=0.5
单选题马铃薯对肥料三要素的需要以()AN最多,K次之,P较少BK最多,P次之,N最少CK最多,N次之,P较少DP最多,K次之,N最少