




下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、姓名:_ 班級(jí):_ 學(xué)號(hào):_-密-封 -線- 初級(jí)程序員填空集考試卷 模擬考試題考試時(shí)間:120分鐘 考試總分:100分題號(hào)一二三四五總分分?jǐn)?shù)遵守考場紀(jì)律,維護(hù)知識(shí)尊嚴(yán),杜絕違紀(jì)行為,確??荚嚱Y(jié)果公正。1、說明以下程序的功能是計(jì)算三角形、矩形和正方形的面積并輸出,程序由5個(gè)類組成:areatest是主類,類trianlge、rectangle和square分別表示三角形、矩形和正方形,抽象類figure提供了一個(gè)計(jì)算面積的抽象方法。程序public class areatestpublic static void main(string args )figure figures= new tr
2、iangle (2,3,3) ,new rectangle (5,8) ,new square (5) ;for (int i=0; 1(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);
3、class square extends(3)public square(double width)(4);public string tostring ( )return “square: width= “+width+” : “ ;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 : s
4、ides= “+la+” , “+lb+” , “ +lc+” : “ ;public double getarea ( )double s= (la+lb+lc)/2.0;return math. sqrt (s* (s-la) * (s-lb) * (s-lc) ;( )2、說明以下程序的功能是計(jì)算三角形、矩形和正方形的面積并輸出,程序由5個(gè)類組成:areatest是主類,類trianlge、rectangle和square分別表示三角形、矩形和正方形,抽象類figure提供了一個(gè)計(jì)算面積的抽象方法。程序public class areatestpublic static void mai
5、n(string args )figure figures= new triangle (2,3,3) ,new rectangle (5,8) ,new square (5) ;for (int i=0; 1(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+”:
6、”;public double getarea ( )return(2);class square extends(3)public square(double width)(4);public string tostring ( )return “square: width= “+width+” : “ ;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 s
7、tring 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-lc) ;( )3、說明以下程序的功能是計(jì)算三角形、矩形和正方形的面積并輸出,程序由5個(gè)類組成:areatest是主類,類trianlge、rectangle和square分別表示三角形、矩形和正方形,抽象類figure提供了一個(gè)計(jì)算面積的抽象方法。程序public
8、 class areatestpublic static void main(string args )figure figures= new triangle (2,3,3) ,new rectangle (5,8) ,new square (5) ;for (int i=0; 1(1)double height;double width;public rectangle(double height, double width)this .height=height;this.width=width;public string tostring ( )return “rectangle: h
9、eight= “+height+” , width= “+width+”:”;public double getarea ( )return(2);class square extends(3)public square(double width)(4);public string tostring ( )return “square: width= “+width+” : “ ;class triangle extends(5)double la;double lb;double lc;public triangle(double la,double lb, double lc)this.l
10、a=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-lc) ;( )4、說明以下程序的功能是計(jì)算三角形、矩形和正方形的面積并輸出,程序由5個(gè)類組成:areatest是主類,類trianlge、rectangle和square分別表示三角形、矩形
11、和正方形,抽象類figure提供了一個(gè)計(jì)算面積的抽象方法。程序public class areatestpublic static void main(string args )figure figures= new triangle (2,3,3) ,new rectangle (5,8) ,new square (5) ;for (int i=0; 1(1)double height;double width;public rectangle(double height, double width)this .height=height;this.width=width;public st
12、ring tostring ( )return “rectangle: height= “+height+” , width= “+width+”:”;public double getarea ( )return(2);class square extends(3)public square(double width)(4);public string tostring ( )return “square: width= “+width+” : “ ;class triangle extends(5)double la;double lb;double lc;public triangle(
13、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-lc) ;( )5、說明以下程序的功能是計(jì)算三角形、矩形和正方形的面積并輸出,程序由5個(gè)類組成:areatest是主類
14、,類trianlge、rectangle和square分別表示三角形、矩形和正方形,抽象類figure提供了一個(gè)計(jì)算面積的抽象方法。程序public class areatestpublic static void main(string args )figure figures= new triangle (2,3,3) ,new rectangle (5,8) ,new square (5) ;for (int i=0; 1(1)double height;double width;public rectangle(double height, double width)this .hei
15、ght=height;this.width=width;public string tostring ( )return “rectangle: height= “+height+” , width= “+width+”:”;public double getarea ( )return(2);class square extends(3)public square(double width)(4);public string tostring ( )return “square: width= “+width+” : “ ;class triangle extends(5)double la;double lb;double lc;public triangle(double la,double lb, do
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 第四節(jié)醛和酮的化學(xué)性質(zhì)一加成反應(yīng)02課件
- 2025安徽蕪湖市市屬國有企業(yè)招聘74人筆試歷年參考題庫附帶答案詳解
- 智能駕駛技術(shù)發(fā)展趨勢及市場前景
- 化肥調(diào)控政策解讀課件
- 2024年甘肅省臨夏縣人民醫(yī)院公開招聘護(hù)理工作人員試題帶答案詳解
- 臨海市村衛(wèi)生室標(biāo)準(zhǔn)化建設(shè)(2020-2022年)實(shí)施方案
- 中國重卡汽車行業(yè)投資研究分析及發(fā)展前景預(yù)測報(bào)告
- 病原生物學(xué)教學(xué)平臺(tái)課件
- 2025年中國運(yùn)動(dòng)健身器材行業(yè)發(fā)展運(yùn)行現(xiàn)狀及投資潛力預(yù)測報(bào)告
- 真空熱處理項(xiàng)目可行性研究報(bào)告
- 煤礦開掘技術(shù)操作規(guī)程
- 2023年上海市長寧區(qū)高三年級(jí)下冊二模英語試卷含詳解
- 肺功能進(jìn)修總結(jié)匯報(bào)
- GB/T 3428-2024架空導(dǎo)線用鍍鋅鋼線
- 客運(yùn)駕駛員汛期安全培訓(xùn)
- 【1例心肌梗塞患者的PCI術(shù)后護(hù)理探究7800字(論文)】
- 中國特色社會(huì)主義民族發(fā)展理論研究
- 干部基本信息審核認(rèn)定表
- 采購管理中的創(chuàng)新與持續(xù)改進(jìn)
- GB/T 5465.2-2023電氣設(shè)備用圖形符號(hào)第2部分:圖形符號(hào)
- 湖南省永州冷水灘區(qū)2021-2022學(xué)年七年級(jí)下學(xué)期期末語文試題答案
評論
0/150
提交評論