class ChangFangXing{

創(chuàng)新互聯(lián)公司是一家專注于成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站與策劃設(shè)計(jì),廣州網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設(shè)10余年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:廣州等地區(qū)。廣州做網(wǎng)站價(jià)格咨詢:028-86922220
private int length;
private int width;
public ChangFangXing(){}
public void setLength(int length){
this.length = length;
}
public void setWidth(int width){
this.width = width;
}
/李棚/求周長
public int getZhouChang(){
return (length + width)*2;
}
public int getArea(){
return length * width;
}
}
class ChangFangXingDemo{
public static void main(String[] args){
ChangFangXing s = new ChangFangXing();
s.setLength(5);
s.setWidth(6);
System.out.println("長方形的周棚悉長鏈擾乎為:"+s.getZhouChang());
System.out.println("長方形的面積為:"+s.getArea());
}
}
import java.text.DecimalFormat;
/**
* Created by ASUS on 2018/跡或灶10/24.
*/
public class test {
static final double p = 3.14;
//圓的姿扮面積為
public static double c(double r){
return p*r*r;
}
//圓的周長
public static double s(double r){
return 2*p*r;
}
public static void main(String [] arge){
System.out.println(fmt(c(2.3d)));
System.out.println(fmt(s(2.3d)));
}
private static String fmt(double rest){
DecimalFormat df = null;
df = new DecimalFormat("###,##0.00"團(tuán)知);
return df.format(rest);
}
}
文章標(biāo)題:java代碼圓的周長 javabean計(jì)算圓的周長和面積
URL標(biāo)題:http://chinadenli.net/article14/dspppge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、網(wǎng)站策劃、做網(wǎng)站、用戶體驗(yàn)、企業(yè)網(wǎng)站制作、域名注冊(cè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)