第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Java問題,怎么求長方體的體積

Java問題,怎么求長方體的體積

珂珂涼 2016-03-05 15:35:54
?class Cuboid { double a; double b;? ? ? ? ? ? ?double h;? ? ? ? ? ? ?double area; public Cuboid(double a, double b,double h){ this.a = a; this.b = b; this.h = h; } public Cuboid() { // TODO Auto-generated constructor stub } double Area(){ area=a*b*h; return area; } }? ?public class ?Test67{?? ?public static void main(String args[]){ ? Cuboid cuboid = new Cuboid(); ? double a=12.5,b=5.2,h=2.5; ? Cuboid.Cuboid(a,b,h); ? System.out.println("長方提體的體積是:"+cuboid.Area());}}這是題目:1.?編程擴(kuò)展下面的矩形類(Rect)為長方體類(Cuboid),要求增加高度(h)屬性,并求出長方體的體積(Volume)。public?class?Rect?{double?a;double?b;?public?Rect(double?a,?double?b){this.a?=?a;this.b?=?b;}public?double?Area(){return?a?*?b;}}
查看完整描述

1 回答

已采納
?
Its_forever

TA貢獻(xiàn)361條經(jīng)驗(yàn) 獲得超328個(gè)贊

public?class?Rect?{
double?a;
double?b;
double?c;
//帶三個(gè)參數(shù)(長寬高)的構(gòu)造函數(shù)
public?Rect(double?a,?double?b,double?c){
this.a?=?a;
this.b?=?b;
this.c?=?c;
}
public?double?Area(){
return?a?*?b*?c;
}
public?static?void?main(String[]?args)?{
	Rect?r?=?new?Rect(2.1,3.2,4.3);
	System.out.println(r.Area());
}
}


查看完整回答
1 反對 回復(fù) 2016-03-06
  • 1 回答
  • 0 關(guān)注
  • 1970 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號