SlideShare a Scribd company logo
1 of 6
我把分數提高了 , 請大家把握機會 !
練習四 : 物件導向基本概
念之練習
練習一
 試設計出一個類別能有以下功能
 我有 5 隻母雞 , 每隻母雞每天會下 1-3 個蛋
 這 5 隻母雞每次下完蛋都會在一個共同的地方記錄
它下蛋的數量
 試寫一支程式模擬 20 天後 , 一共下了多少顆蛋
1 分
練習二
 依照以下敍述 , 設計出相關類別 :
 某公司有員工數十人 , 員工在進入公司後 , 均會分
配一個編號 , 此編號為一流水號。公司亦會紀錄員
工的姓名 , 出生日 , 進入公司的日期 , 之外 , 一些基
本屬性亦會詳加記載 , 例如 : 性別 , 身高 , 體重及專
長。
 公司在成立時並不會有任何員工 , 必須提供員工加
入及員工離職的功能
 員工資料一但被建立後 , 他們的編號 , 姓名 , 生日 ,
進公司日期 , 性別均只能被讀取而不能再改變
註 : 日期型別尚未教授 , 但可自行去查看看 , 如果有困難 , 可以字串
代替
2 分
練習三 (*)
 依照以下敍述 , 設計出類別 (1 分 )
 某公司有員工 , 除了老闆之外 , 每一位員工均有一
個主管 , 主管也是員工
 這題僅需要設計員工類別及所需的屬性
 進階題 (2 分 ): 設計一些員工 , 建立之間的關係 ,
並以遞迴方式全部印出來
1+2 分
練習四
 建立一個骰子的類別 , 可以透過建構式決定其
骰子的面數
 骰子有一個 " 擲 (roll)" 的方法 , 可以取得擲出的
結果
 試產生三個骰子 , 並將三個骰子擲出
 依照下列規則顯示出點數
 三個骰子中必需有二個骰子點數要相等 , 則第三個
骰子的點數為其所得點數。
 若三個骰子中沒有任何二個骰子點數相等 , 則重擲
一次。
 顯示出實際點數為何。
2 分
練習四
 建立一個骰子的類別 , 可以透過建構式決定其
骰子的面數
 骰子有一個 " 擲 (roll)" 的方法 , 可以取得擲出的
結果
 試產生三個骰子 , 並將三個骰子擲出
 依照下列規則顯示出點數
 三個骰子中必需有二個骰子點數要相等 , 則第三個
骰子的點數為其所得點數。
 若三個骰子中沒有任何二個骰子點數相等 , 則重擲
一次。
 顯示出實際點數為何。
2 分

More Related Content

Viewers also liked

Kebudayaan melayu ppoint
Kebudayaan melayu ppointKebudayaan melayu ppoint
Kebudayaan melayu ppoint
Azura Zainol
 
Bahan Pelatihan PKM
Bahan Pelatihan PKMBahan Pelatihan PKM
Bahan Pelatihan PKM
Zakaria bats
 
Gnatt chart ps
Gnatt chart psGnatt chart ps
Gnatt chart ps
LeafyJ
 
tư vấn bán đồng hồ casio chính hãng giá tốt
tư vấn bán đồng hồ casio chính hãng giá tốttư vấn bán đồng hồ casio chính hãng giá tốt
tư vấn bán đồng hồ casio chính hãng giá tốt
lamar214
 
Achievement of NXP
Achievement of NXPAchievement of NXP
Achievement of NXP
Charlie Wang
 
Konstrukcija Hala 8.5 x 24 m Izgled_
Konstrukcija Hala 8.5 x 24 m Izgled_Konstrukcija Hala 8.5 x 24 m Izgled_
Konstrukcija Hala 8.5 x 24 m Izgled_
Nikola Ilic
 
06) penulisan modul kbat dan teknik penyoalan t6 2014
06) penulisan modul kbat dan teknik penyoalan t6 201406) penulisan modul kbat dan teknik penyoalan t6 2014
06) penulisan modul kbat dan teknik penyoalan t6 2014
Nor Afida Ghazani
 
Briófitas
BriófitasBriófitas
Briófitas
Segundao
 

Viewers also liked (15)

Kebudayaan melayu ppoint
Kebudayaan melayu ppointKebudayaan melayu ppoint
Kebudayaan melayu ppoint
 
Bahan Pelatihan PKM
Bahan Pelatihan PKMBahan Pelatihan PKM
Bahan Pelatihan PKM
 
Gnatt chart ps
Gnatt chart psGnatt chart ps
Gnatt chart ps
 
tư vấn bán đồng hồ casio chính hãng giá tốt
tư vấn bán đồng hồ casio chính hãng giá tốttư vấn bán đồng hồ casio chính hãng giá tốt
tư vấn bán đồng hồ casio chính hãng giá tốt
 
Quinta sesión ordinaria 2014 2015
Quinta sesión ordinaria 2014 2015Quinta sesión ordinaria 2014 2015
Quinta sesión ordinaria 2014 2015
 
Achievement of NXP
Achievement of NXPAchievement of NXP
Achievement of NXP
 
REF PACE
REF PACEREF PACE
REF PACE
 
Presentazione del metodo di coaching: positivo operativo strategico© a cura d...
Presentazione del metodo di coaching: positivo operativo strategico© a cura d...Presentazione del metodo di coaching: positivo operativo strategico© a cura d...
Presentazione del metodo di coaching: positivo operativo strategico© a cura d...
 
игра богатыри
игра богатыриигра богатыри
игра богатыри
 
Konstrukcija Hala 8.5 x 24 m Izgled_
Konstrukcija Hala 8.5 x 24 m Izgled_Konstrukcija Hala 8.5 x 24 m Izgled_
Konstrukcija Hala 8.5 x 24 m Izgled_
 
06) penulisan modul kbat dan teknik penyoalan t6 2014
06) penulisan modul kbat dan teknik penyoalan t6 201406) penulisan modul kbat dan teknik penyoalan t6 2014
06) penulisan modul kbat dan teknik penyoalan t6 2014
 
Pteridófitaspdf
PteridófitaspdfPteridófitaspdf
Pteridófitaspdf
 
Akuntansi Keuangan Lanjut II (Persoalan Khusus)
Akuntansi Keuangan Lanjut II (Persoalan Khusus)Akuntansi Keuangan Lanjut II (Persoalan Khusus)
Akuntansi Keuangan Lanjut II (Persoalan Khusus)
 
Java001
Java001Java001
Java001
 
Briófitas
BriófitasBriófitas
Briófitas
 

More from Sam Chen (6)

Test(p1~p5)
Test(p1~p5)Test(p1~p5)
Test(p1~p5)
 
Test(p1~p5)
Test(p1~p5)Test(p1~p5)
Test(p1~p5)
 
教學進度.Pdftest
教學進度.Pdftest教學進度.Pdftest
教學進度.Pdftest
 
104上高職(教)推廣教育訓練 -xx科
104上高職(教)推廣教育訓練 -xx科104上高職(教)推廣教育訓練 -xx科
104上高職(教)推廣教育訓練 -xx科
 
第二篇 第六章
第二篇 第六章第二篇 第六章
第二篇 第六章
 
Search engine-optimization-starter-guide-zh-tw
Search engine-optimization-starter-guide-zh-twSearch engine-optimization-starter-guide-zh-tw
Search engine-optimization-starter-guide-zh-tw
 

Recently uploaded

IN Port Alfred [[[[WhatsApp (((+27632505360))) *____**)) ABORTION PILLS FOR S...
IN Port Alfred [[[[WhatsApp (((+27632505360))) *____**)) ABORTION PILLS FOR S...IN Port Alfred [[[[WhatsApp (((+27632505360))) *____**)) ABORTION PILLS FOR S...
IN Port Alfred [[[[WhatsApp (((+27632505360))) *____**)) ABORTION PILLS FOR S...
schonejummy
 
Abortion Pills for sale in Ajman (UAE) ((+27.7377;58;557) Abortion Pills / Cy...
Abortion Pills for sale in Ajman (UAE) ((+27.7377;58;557) Abortion Pills / Cy...Abortion Pills for sale in Ajman (UAE) ((+27.7377;58;557) Abortion Pills / Cy...
Abortion Pills for sale in Ajman (UAE) ((+27.7377;58;557) Abortion Pills / Cy...
daisycvs
 
Al Doha +971552965071 Abortion Pills in Doha Qatar Al Wakrah misoprostol/cyto...
Al Doha +971552965071 Abortion Pills in Doha Qatar Al Wakrah misoprostol/cyto...Al Doha +971552965071 Abortion Pills in Doha Qatar Al Wakrah misoprostol/cyto...
Al Doha +971552965071 Abortion Pills in Doha Qatar Al Wakrah misoprostol/cyto...
schonejummy
 
Abortion in AL AIN*%UAE^*[☎️+971523788684**]]@ @# Abortion pills for sale in ...
Abortion in AL AIN*%UAE^*[☎️+971523788684**]]@ @# Abortion pills for sale in ...Abortion in AL AIN*%UAE^*[☎️+971523788684**]]@ @# Abortion pills for sale in ...
Abortion in AL AIN*%UAE^*[☎️+971523788684**]]@ @# Abortion pills for sale in ...
fionamali24
 
Bulawayo +27632505360 Abortion Pills in Bulawayo Harare Cytotec/Misoprostol i...
Bulawayo +27632505360 Abortion Pills in Bulawayo Harare Cytotec/Misoprostol i...Bulawayo +27632505360 Abortion Pills in Bulawayo Harare Cytotec/Misoprostol i...
Bulawayo +27632505360 Abortion Pills in Bulawayo Harare Cytotec/Misoprostol i...
schonejummy
 
IN MUSCAT & OMAN 🏥[^(+968_76875161*))☎️)¥) LEGIT Cytotec Pills.
IN MUSCAT & OMAN 🏥[^(+968_76875161*))☎️)¥) LEGIT Cytotec Pills.IN MUSCAT & OMAN 🏥[^(+968_76875161*))☎️)¥) LEGIT Cytotec Pills.
IN MUSCAT & OMAN 🏥[^(+968_76875161*))☎️)¥) LEGIT Cytotec Pills.
zuhaibhaideri99
 
Secunda +27<~>0632505360 Abortion Pills Around Embalenhle Approved Safe 4 Ter...
Secunda +27<~>0632505360 Abortion Pills Around Embalenhle Approved Safe 4 Ter...Secunda +27<~>0632505360 Abortion Pills Around Embalenhle Approved Safe 4 Ter...
Secunda +27<~>0632505360 Abortion Pills Around Embalenhle Approved Safe 4 Ter...
ramacollinz
 
ABORTION PILLS IN AL WAKRAH《@௵+971523788684௵》CYTOTEC TABLETS FOR SALE IN DOHA...
ABORTION PILLS IN AL WAKRAH《@௵+971523788684௵》CYTOTEC TABLETS FOR SALE IN DOHA...ABORTION PILLS IN AL WAKRAH《@௵+971523788684௵》CYTOTEC TABLETS FOR SALE IN DOHA...
ABORTION PILLS IN AL WAKRAH《@௵+971523788684௵》CYTOTEC TABLETS FOR SALE IN DOHA...
cytotecshop6
 
Kuwait City₩Kit【+971523788684】彡 ௹#Abortion Pills For sale In Kuwait City.
Kuwait City₩Kit【+971523788684】彡 ௹#Abortion Pills For sale In Kuwait City.Kuwait City₩Kit【+971523788684】彡 ௹#Abortion Pills For sale In Kuwait City.
Kuwait City₩Kit【+971523788684】彡 ௹#Abortion Pills For sale In Kuwait City.
fionamali24
 
Where to buy(^^+27737758557** Abortion Pills in Dubai/UAE/ Abudhabi/Fujairah ...
Where to buy(^^+27737758557** Abortion Pills in Dubai/UAE/ Abudhabi/Fujairah ...Where to buy(^^+27737758557** Abortion Pills in Dubai/UAE/ Abudhabi/Fujairah ...
Where to buy(^^+27737758557** Abortion Pills in Dubai/UAE/ Abudhabi/Fujairah ...
daisycvs
 
ABORTION PILLS IN BADPLAAS [(+27632505360 BUY CYTOTEC PILLS IN BADPLAAS/ABORT...
ABORTION PILLS IN BADPLAAS [(+27632505360 BUY CYTOTEC PILLS IN BADPLAAS/ABORT...ABORTION PILLS IN BADPLAAS [(+27632505360 BUY CYTOTEC PILLS IN BADPLAAS/ABORT...
ABORTION PILLS IN BADPLAAS [(+27632505360 BUY CYTOTEC PILLS IN BADPLAAS/ABORT...
ramacollinz
 
Hi 00971552965071 ABORTION PILLS IN Marina Palm Jumeirah JVC
Hi 00971552965071 ABORTION PILLS IN Marina Palm Jumeirah JVCHi 00971552965071 ABORTION PILLS IN Marina Palm Jumeirah JVC
Hi 00971552965071 ABORTION PILLS IN Marina Palm Jumeirah JVC
schonejummy
 

Recently uploaded (14)

IN Port Alfred [[[[WhatsApp (((+27632505360))) *____**)) ABORTION PILLS FOR S...
IN Port Alfred [[[[WhatsApp (((+27632505360))) *____**)) ABORTION PILLS FOR S...IN Port Alfred [[[[WhatsApp (((+27632505360))) *____**)) ABORTION PILLS FOR S...
IN Port Alfred [[[[WhatsApp (((+27632505360))) *____**)) ABORTION PILLS FOR S...
 
Abortion Pills for sale in Ajman (UAE) ((+27.7377;58;557) Abortion Pills / Cy...
Abortion Pills for sale in Ajman (UAE) ((+27.7377;58;557) Abortion Pills / Cy...Abortion Pills for sale in Ajman (UAE) ((+27.7377;58;557) Abortion Pills / Cy...
Abortion Pills for sale in Ajman (UAE) ((+27.7377;58;557) Abortion Pills / Cy...
 
Al Doha +971552965071 Abortion Pills in Doha Qatar Al Wakrah misoprostol/cyto...
Al Doha +971552965071 Abortion Pills in Doha Qatar Al Wakrah misoprostol/cyto...Al Doha +971552965071 Abortion Pills in Doha Qatar Al Wakrah misoprostol/cyto...
Al Doha +971552965071 Abortion Pills in Doha Qatar Al Wakrah misoprostol/cyto...
 
Abortion in AL AIN*%UAE^*[☎️+971523788684**]]@ @# Abortion pills for sale in ...
Abortion in AL AIN*%UAE^*[☎️+971523788684**]]@ @# Abortion pills for sale in ...Abortion in AL AIN*%UAE^*[☎️+971523788684**]]@ @# Abortion pills for sale in ...
Abortion in AL AIN*%UAE^*[☎️+971523788684**]]@ @# Abortion pills for sale in ...
 
Bulawayo +27632505360 Abortion Pills in Bulawayo Harare Cytotec/Misoprostol i...
Bulawayo +27632505360 Abortion Pills in Bulawayo Harare Cytotec/Misoprostol i...Bulawayo +27632505360 Abortion Pills in Bulawayo Harare Cytotec/Misoprostol i...
Bulawayo +27632505360 Abortion Pills in Bulawayo Harare Cytotec/Misoprostol i...
 
IN MUSCAT & OMAN 🏥[^(+968_76875161*))☎️)¥) LEGIT Cytotec Pills.
IN MUSCAT & OMAN 🏥[^(+968_76875161*))☎️)¥) LEGIT Cytotec Pills.IN MUSCAT & OMAN 🏥[^(+968_76875161*))☎️)¥) LEGIT Cytotec Pills.
IN MUSCAT & OMAN 🏥[^(+968_76875161*))☎️)¥) LEGIT Cytotec Pills.
 
Secunda +27<~>0632505360 Abortion Pills Around Embalenhle Approved Safe 4 Ter...
Secunda +27<~>0632505360 Abortion Pills Around Embalenhle Approved Safe 4 Ter...Secunda +27<~>0632505360 Abortion Pills Around Embalenhle Approved Safe 4 Ter...
Secunda +27<~>0632505360 Abortion Pills Around Embalenhle Approved Safe 4 Ter...
 
ABORTION PILLS IN AL WAKRAH《@௵+971523788684௵》CYTOTEC TABLETS FOR SALE IN DOHA...
ABORTION PILLS IN AL WAKRAH《@௵+971523788684௵》CYTOTEC TABLETS FOR SALE IN DOHA...ABORTION PILLS IN AL WAKRAH《@௵+971523788684௵》CYTOTEC TABLETS FOR SALE IN DOHA...
ABORTION PILLS IN AL WAKRAH《@௵+971523788684௵》CYTOTEC TABLETS FOR SALE IN DOHA...
 
《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》
《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》
《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》《段永平(投資的本質)》
 
Kuwait City₩Kit【+971523788684】彡 ௹#Abortion Pills For sale In Kuwait City.
Kuwait City₩Kit【+971523788684】彡 ௹#Abortion Pills For sale In Kuwait City.Kuwait City₩Kit【+971523788684】彡 ௹#Abortion Pills For sale In Kuwait City.
Kuwait City₩Kit【+971523788684】彡 ௹#Abortion Pills For sale In Kuwait City.
 
Where to buy(^^+27737758557** Abortion Pills in Dubai/UAE/ Abudhabi/Fujairah ...
Where to buy(^^+27737758557** Abortion Pills in Dubai/UAE/ Abudhabi/Fujairah ...Where to buy(^^+27737758557** Abortion Pills in Dubai/UAE/ Abudhabi/Fujairah ...
Where to buy(^^+27737758557** Abortion Pills in Dubai/UAE/ Abudhabi/Fujairah ...
 
cs代写服务如何收费?坚持高性价比的服务宗旨 ,满足更多留学生的CS作业代写需求,为大家提供最合理的代写价格。
cs代写服务如何收费?坚持高性价比的服务宗旨 ,满足更多留学生的CS作业代写需求,为大家提供最合理的代写价格。cs代写服务如何收费?坚持高性价比的服务宗旨 ,满足更多留学生的CS作业代写需求,为大家提供最合理的代写价格。
cs代写服务如何收费?坚持高性价比的服务宗旨 ,满足更多留学生的CS作业代写需求,为大家提供最合理的代写价格。
 
ABORTION PILLS IN BADPLAAS [(+27632505360 BUY CYTOTEC PILLS IN BADPLAAS/ABORT...
ABORTION PILLS IN BADPLAAS [(+27632505360 BUY CYTOTEC PILLS IN BADPLAAS/ABORT...ABORTION PILLS IN BADPLAAS [(+27632505360 BUY CYTOTEC PILLS IN BADPLAAS/ABORT...
ABORTION PILLS IN BADPLAAS [(+27632505360 BUY CYTOTEC PILLS IN BADPLAAS/ABORT...
 
Hi 00971552965071 ABORTION PILLS IN Marina Palm Jumeirah JVC
Hi 00971552965071 ABORTION PILLS IN Marina Palm Jumeirah JVCHi 00971552965071 ABORTION PILLS IN Marina Palm Jumeirah JVC
Hi 00971552965071 ABORTION PILLS IN Marina Palm Jumeirah JVC
 

練習四(分數加倍,請大家把握機會)

  • 1. 我把分數提高了 , 請大家把握機會 ! 練習四 : 物件導向基本概 念之練習
  • 2. 練習一  試設計出一個類別能有以下功能  我有 5 隻母雞 , 每隻母雞每天會下 1-3 個蛋  這 5 隻母雞每次下完蛋都會在一個共同的地方記錄 它下蛋的數量  試寫一支程式模擬 20 天後 , 一共下了多少顆蛋 1 分
  • 3. 練習二  依照以下敍述 , 設計出相關類別 :  某公司有員工數十人 , 員工在進入公司後 , 均會分 配一個編號 , 此編號為一流水號。公司亦會紀錄員 工的姓名 , 出生日 , 進入公司的日期 , 之外 , 一些基 本屬性亦會詳加記載 , 例如 : 性別 , 身高 , 體重及專 長。  公司在成立時並不會有任何員工 , 必須提供員工加 入及員工離職的功能  員工資料一但被建立後 , 他們的編號 , 姓名 , 生日 , 進公司日期 , 性別均只能被讀取而不能再改變 註 : 日期型別尚未教授 , 但可自行去查看看 , 如果有困難 , 可以字串 代替 2 分
  • 4. 練習三 (*)  依照以下敍述 , 設計出類別 (1 分 )  某公司有員工 , 除了老闆之外 , 每一位員工均有一 個主管 , 主管也是員工  這題僅需要設計員工類別及所需的屬性  進階題 (2 分 ): 設計一些員工 , 建立之間的關係 , 並以遞迴方式全部印出來 1+2 分
  • 5. 練習四  建立一個骰子的類別 , 可以透過建構式決定其 骰子的面數  骰子有一個 " 擲 (roll)" 的方法 , 可以取得擲出的 結果  試產生三個骰子 , 並將三個骰子擲出  依照下列規則顯示出點數  三個骰子中必需有二個骰子點數要相等 , 則第三個 骰子的點數為其所得點數。  若三個骰子中沒有任何二個骰子點數相等 , 則重擲 一次。  顯示出實際點數為何。 2 分
  • 6. 練習四  建立一個骰子的類別 , 可以透過建構式決定其 骰子的面數  骰子有一個 " 擲 (roll)" 的方法 , 可以取得擲出的 結果  試產生三個骰子 , 並將三個骰子擲出  依照下列規則顯示出點數  三個骰子中必需有二個骰子點數要相等 , 則第三個 骰子的點數為其所得點數。  若三個骰子中沒有任何二個骰子點數相等 , 則重擲 一次。  顯示出實際點數為何。 2 分

Editor's Notes

  1. Date 要引入 java.util.*; 同一個檔案若有二個class, compiler後,每一個class會有一個檔案產生