导航:首页 > 编程语言 > java程序设置课后习题答案

java程序设置课后习题答案

发布时间:2024-12-06 02:26:09

A. java语言程序设计两道练习题。谢谢!

第一题有问题:1、创建Person接口(即“人”),它有setData()和getData()方法对“人”属性name、sex和birthday赋值和获得这些属性组成的字符串信息。
问题是:你说要创建一个人(接口),然后里面有方法对人的属性进行赋值?这怎么可能呢,接口是没有成员变量(属性)的,怎么能赋值?接口里只能有常量。

第二题可以答一下:
package pillar;
public class Pillar { private Geometry buttom;
private double height;
public Pillar() {
// TODO Auto-generated constructor stub
}
public Pillar(Geometry button,double height){
this.buttom = button;
this.height = height;
}
public double getVolume(){
return this.buttom.getArea()*height;
}
public Geometry getButtom() {
return buttom;
}
public void setButtom(Geometry buttom) {
this.buttom = buttom;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}

}
------------------------------------------------类分割线---------------------------------------------------------
package pillar;
public interface Geometry { double getArea();
}
------------------------------------------------类分割线---------------------------------------------------------
package pillar;
public class Circle implements Geometry { private double r;
public Circle() {
// TODO Auto-generated constructor stub
}

public Circle(double r) {
this.r = r;
}

public double getArea() { return Math.PI*r*r;
}
public double getR() {
return r;
}
public void setR(double r) {
this.r = r;
}

}
------------------------------------------------类分割线---------------------------------------------------------
package pillar;
public class Rectangle implements Geometry { private double width;
private double height;

public Rectangle() {
// TODO Auto-generated constructor stub
}

public Rectangle(double width, double height) {
this.width = width;
this.height = height;
}

public double getArea() { return this.width*this.height;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}

}
------------------------------------------------类分割线---------------------------------------------------------
package pillar;
public class TestPillar {
/** * @param args
*/
public static void main(String[] args) {
Circle c = new Circle(5);
Rectangle r = new Rectangle(3,4);
Pillar p1 = new Pillar(c,6);
Pillar p2 = new Pillar(r,6);
System.out.println("圆的体积:"+p1.getVolume()+"\t矩形的体积:"+p2.getVolume());
}

}

B. 您好!我想要《Java语言程序设计基础篇》第六版的练习题和编程题答案,谢谢了.

:1.No permission ————has for anybodyto enter the building.(N M ET1988)
A.been given B.givenC.to give D.be giving
A。析语境可知,该空表示被给,应用被动语态,has后面应接been done。
2.U ntil now,his hom ework has not————finished.
A.being B.be C.been D.to be
C。语境逻辑制约家庭作业是被完成的,因此该空应用被动语态,has后面应使用been done的形式。点评:现在完成时被动语态结构为has/have been done,使用has been done时主语为单数,使用have been done时主语为复数。解题时应首先分析语境逻辑确定现在完成时被动语态,然后对照其结构公式确定答案。
3.The window————.Y ou need notwash it again.
A.is w ashed B.was washedC.has been washed D.will be washed析:
C。该句强调窗户已被清洗。
4.It seem that dinner ____for a long time.
A.is cooked B.has been cooked C.was cooked D had been cooked
B.表示晚饭已经准备好了。对现在有影响。
5。When my article ____.I'll come to see you .
A.is finished B is being finished C has been finished D will be finished
C 现在完成时被动语态代替将来完成时被动语态。

1. I'm sorry, sir. Your recorder isn't ready yet. It______in the factory.

A. is being repaired B. is repaired

C. has been repaired

D. hasn't repaired

本题并没有明确的时间状语,但从上文的意思看,“修理”这个动作正在进行;it指代上文提到的录音机,它和repair之间存在被动关系。因此应该使用现在进行时的被动语态。B、C两项是被动语态,但时态不对,因此,本题正确答案是A。

2. Some measures______to protect wildlife resources.

A. are taking B. are taken

C. are being taken

D. being taken

解此题时首先要注意到词组take measures to do sth.,由于题干中把宾语measures提前,应该使用被动语态;句子的意思是“正在采取一些措施去保护野生资源”。在表达现在进行时的被动语态的结构中,选项A、B、D均不完整,正确答案应是C。

3. —Have you moved into the new house?

—Not yet. The rooms______.

A. are being painted

B. are painting

C. are painted

D. are being painting

通过题干情景,我们不难看出,由于正在粉刷,因此还不能搬进新房子。分析选项,B项语态不对;C项时态不对;D项结构错误,所以正确答案应该是A。

4. A new building______at the other side of the street. Work started last year and the building is expected to open next year.

A. is built

B. is being built

C. has built

D. will be built

题干的后半部分告诉我们:“去年开工,预计明年竣工。”由此可知,大楼正在建设中,所以选项A、C、D时态均不对。正确答案应该是B。

5. It is well-known to us that a lot of rivers______by the factories.

A. are polluting

B. have been polluting

C. are being polluting

D. are being polluted

题干的意思是:“众所周知,许多河流正在被工厂污染。”说明了目前河流正在被污染的严重状况。A、B两项语态不对;C项结构错误,正确答案是D。

the man was being operated at that time .
at that time we all being showed how to swim.
the bridge was being repaired when we passed.
the road was being repaired we had to make a
while the supper was being prepared the light
at tha t time my classment was being showed how to use computers.
the book was being translated by him this time last year.
the question was been disgussed at the meeting yesterday afternoon.

过去进行时只找到例句,不好意思。

C. 《JAVA程序设计》考题急求答案,急求java试题简答,java课后习题答案.(拒绝打酱油)

对几个容易错的稍微注解下,
1 D
2 C final修饰
3 B
4 B
5 C
6 B
7 C
8 C
9 B JAVA里面都是写作null的,而不是NULL
10 A: String.substring()大小写问题回
11 C
12C
13A
14C
15A
16B
17C
18C
19D
20D管道流,此流一般用答于多线

阅读全文

与java程序设置课后习题答案相关的资料

热点内容
省内顺丰邮文件多少钱 浏览:715
绝密级文件应保留多少年 浏览:701
发文件给同事怎么说 浏览:468
苹果80岁用什么app 浏览:28
顺丰寄快递文件多少钱 浏览:164
消费邦app是怎么反现的 浏览:112
java调用接口方法 浏览:742
微信一种以上绑定关系 浏览:183
word图片编辑大小边框 浏览:468
威迅java培训 浏览:389
linux禅道无法访问 浏览:819
怎么爬取历史疫情数据 浏览:596
linuxjira6破解 浏览:694
哪个网站可以看所有检察杂志 浏览:144
java高并发数据库请求怎么办 浏览:551
win8怎么打开gho文件怎么打开 浏览:732
如何网站内搜索 浏览:362
qq附近的人客服号码 浏览:570
mac怎么把word文件转换为pdf 浏览:6
正式文件中的文档行距多少 浏览:202

友情链接