Public square dancing, a form. of exercise which is always performed in public places, has
In the public square of London Bridge Tower you can NOT
A.have dinners.
B.have a bird's eye view of London.
C.visit art galleries.
D.watch movies.
What is NOT mentioned about the plans?
A.An atrium will be added.
B.A public square will be constructed.
C.One wing will be expanded.
D.A green outdoor area will be created.
A.输出10
B.编译错误
C.输出0
D.运行错误
用语言描述下面的程序:using System; using System.Collections.Generic; using System.Text; namespace Graph { class Program { static void Main(string[] args) { circular c = new circular(); Console.WriteLine(c.getSides()); square s = new square(); Console.WriteLine(s.getSides()); Graph g; g= new circular(); Console.WriteLine(g.getSides()); g = new square(); Console.WriteLine(g.getSides()); } } public abstract class Graph { public abstract int getSides(); } public class circular : Graph { public override int getSides() { return 1; } } public class square : Graph { public override int getSides() { return 2; } } }
A.have been given much publicity
B.are little known to the public
C.have been widely discussed among builders and city planners
D.have changed the building business
有以下程序#include <iostream>using namespace std;class sample{private: int x;public: sample(int a) { x=a; } friend double square(sample s);};double square(sample s){ return s. x*s. x;}int main(){ sample s1(20),s2(30); cout<<square(s2)<<end1; return 0;}执行结果是()。
A.20
B.30
C.900
D.400
有如下程序: #include <iostream> using namespace std; class shapes { protected: int x, y; public: void setvalue(int d, int w=O) { x=d; y=w; } virtual void disp()=O; }; class square : public shapes { public: void disp () { cout<<x*y<<end1; } }; int main () { shapes *ptr; square s1; ptr=&s1; ptr->setvalue (10, 5) ;ptr->disp(); return 0; } 执行上面的程序将输出()。
A.50
B.5
C.10
D.15
阅读以下说明和Java源程序,将应填入(n)处的字句写在答题纸的对应栏内。
说明
以下程序的功能是计算三角形、矩形和正方形的面积并输出。
程序由5个类组成:AreaTest是主类,类Triangle、Rectangle和Square分别表示三角形、矩形和正方形,抽象类Figure提供了一个计算面积的抽象方法。
程序
public class AreaTest{
public static void main(String args[]){
Figure[]figures={
new Triangle(2,3,3),new Rectangle(5,8), new Square(5)
};
for(int i=0;i<figures.1ength;i++){
System.out.println(figures[i]+"area="+figures[i].getArea());
}
}
}
public abstract class Figure{
public abstract double SetAJea();
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 extends (3) {
public Square(double width) {
(4);
}
public String toString() {
return "Square:width="+width+":";
} } public class Triangle extends (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 getArea() {
double s=(la+lb+lc)/2.0;
return Math.sqrt(s*(s-la)*(s-lb)*(s?1c));
}
}
阅读以下说明和Java源程序,将应填入(n)处的字句写在对应栏内。
【说明】
以下程序能够计算三角形、矩形和正方形的周长并输出。
程序由5个类组成:AreaTest是主类,类Triangle、Rectangle和Square分别表示三角形、矩形和正方形,抽象类Figure提供了一个计算周长的抽象方法。
【程序】
public class girthTest{
public static void 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[i]+"girth="+figures[i].getGirth());
}
}
}
public abstract class Figure{
public abstract double getGirth();
}
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 getGirth(){
return (2);
}
}
public class Square extends (3) {
public Square(double width){
(4);
}
public Stdng toString(){
return "Square:width='+width+":";
}
}
public class Triangle extends (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 getGirth(){
return la+lab+lc;
}
}
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!