系統公告
最近文章發表
最新的回應
- gazettecosplay:
大逃殺有第二部的電影喔... - 匿名:
一開始我好運的得到... - royrizayunatidus:
呵呵........... - 強:
=////////=... - 蟑螂:
北鼻,告訴你...
人氣指數
當日人次:
累積人次:
累積人次:
好時光貼曆
誰來我家
贊助商
其它資訊
本部落所刊登之內容,皆由作者個人所提供,不代表 yam天空部落 本 身立場。
May 8, 2006
royrizayunatidus | 2006-05-08 11:34:48
JAVA
class b1
{
double r;
void setRadius(double a)
{
r=a;
}
double circumference()
{
return Math.PI*2*r;
}
double area()
{
return Math.PI*Math.pow(r,2);
}
}
class square
{
double a;
void setedge(double i)
{
a=i;
}
double circumference()
{
return a*4;
}
double area()
{
return a*a;
}
}
class rectangle
{
double length;
double width;
void setlw(double l,double w)
{
length=l;
width=w;
}
double circumference()
{
return 2*(length+width);
}
double area()
{
return length*width;
}
}
public class a1
{
public static void main (String[] args)
{
o1 c=new o1();
c.setRadius(10);
System.out.println("面積="+c.area()+"周長="+c.circumference());
square s1=new square();
s1.setedge(10);
System.out.println("面積="+s1.area()+"周長="+s1.circumference());
rectangle r1=new rectangle();
r1.setlw(10,5);
System.out.println("面積="+r1.area()+"周長="+r1.circumference());
}
}
發表你的留言 (字數限制 最多 2000 個中文字)
yam天空部落 建置維護 © 1999~2009 webs-tv inc. All Rights Reserved.













