導航:首頁 > 編程語言 > 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程序設置課後習題答案相關的資料

熱點內容
網站參數篩選怎麼做 瀏覽:627
幼兒編程有什麼問題 瀏覽:693
工商銀行app人工服務在哪裡 瀏覽:19
怎麼讓文件中全體內容往下移 瀏覽:783
魔獸爭霸126版本轉換器 瀏覽:984
word2003精簡版下載 瀏覽:703
微博跳轉appstore 瀏覽:537
打開文件時許可權a代表什麼 瀏覽:155
昆侖通態導出數據文件名 瀏覽:338
手機遷移數據為什麼需要重新登錄 瀏覽:958
錄入資料庫的圖片如何更改 瀏覽:132
怎樣獲取郵箱帳號和密碼 瀏覽:809
怎麼通過js實現回到指定頁面 瀏覽:140
如何用網路簽字 瀏覽:552
三星電視拆機教程 瀏覽:19
創維怎麼連接網路 瀏覽:868
2007版word繪圖在哪裡 瀏覽:311
可以拍車牌的app是什麼 瀏覽:508
文件加個井字型大小什麼意思 瀏覽:155
怎麼刪除多重網路 瀏覽:999

友情鏈接