freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

最新c程序設(shè)計(jì)語言期末考試題a有答案終稿-資料下載頁

2025-06-24 00:46本頁面
  

【正文】 c class Jennifer : Bill, IPrintname { public override string WhoAmI() { return Jennifer。 } public void Print() { (WhoAmI())。 }}7. 下列Shape類是一個(gè)表示形狀的抽象類,Area( )為求圖形面積的函數(shù),Total( )則是一個(gè)通用的用求不同形狀的圖形面積總和的函數(shù)。請(qǐng)從Shape類派生矩形類(Rectangle)、圓形類(Circle),給出具體的求面積函數(shù)。并在主函數(shù)中寫出計(jì)算如圖所示圖形面積的語句。(共10分) namespace test{ class Program { static void Main(string[] args) { rectangle rec1 = new rectangle(30,5)。 rectangle rec2 = new rectangle(30,5)。 circle cir1 = new circle(6)。 circle cir2 = new circle(6)。 circle cir3 = new circle(6)。 shape[] s = new shape[5]。 s[0] = rec1。 s[1] = rec2。 s[2] = cir1。 s[3] = cir2。 s[4] = cir3。 (total(s))。 } static double total(shape[] s) { double sum = 。 int n = 。 //for (int i = 0。 i n。 i++) // sum += s[i].area()。 foreach (shape sh in s) { sum += ()。 } return sum。 }}}abstract class shape { public abstract double area()。 } class rectangle : shape { double a, b。 public rectangle(double x, double y) { a = x。 b = y。 } public override double area() { return a * b。 } } class circle : shape { double r。 public circle(double r) { = r。 } public override double area() { return * r * r。 } }第 9 頁 共 9頁
點(diǎn)擊復(fù)制文檔內(nèi)容
范文總結(jié)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1