亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

下面時我寫的程序,本身沒有問題的,請改進一下

下面時我寫的程序,本身沒有問題的,請改進一下

慕瓜7080925 2016-07-24 10:22:30
public class Demo{ public static void main(String[] args){ Rectangle re=new Rectangle(); re.seta(2.5); re.setb(2.8); re.comput(); Circle ci=new Circle(); ci.seta(2.5); ci.setb(3.5); ci.comput(); }}abstract class Shapc{ private double a; private double b; public double geta(){ return a; } public void seta(double a){ this.a=a; } public double getb(){ return b; }? public void setb(double b){ this.b=b; } public abstract void comput();}class Rectangle extends Shapc{ public void comput(){ double rectArea=geta()*getb(); double rectPerimeter=(geta()+getb())*2; System.out.println("矩形的周長:"+rectPerimeter+",矩形的面積:"+rectArea); }}class Circle extends Shapc{ public void comput(){ double cirArea=geta()*getb()*getb(); double cirPerimeter=geta()*getb()*2; System.out.println("圓形的周長:"+cirPerimeter+",圓形的面積:"+cirArea); }}
查看完整描述

2 回答

?
mtexiy_Sss

TA貢獻5條經驗 獲得超3個贊


改進是指?代碼長度?還是變量規范?

查看完整回答
反對 回復 2016-07-25
  • 2 回答
  • 0 關注
  • 1363 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號