首页 > 其他分享 >无

时间:2024-09-26 11:23:52浏览次数:4  
标签: rr float System Circle c1 public

import java.io.;
public class Z2_3_Circle{
final float PI=3.14159f;
float r ;
public void setRadius(float r1)
{
r=r1;
}
public float getRadius()
{
return r;
}
public float getArea()
{
return PI
r*r;
}
public static void main(String[] args)
{
Z2_3_Circle c1 =new Z2_3_Circle();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str=null;
float rr;
System.out.println("请输入圆的半径");
try{
str=br.readLine();
}catch (IOException e){
e.printStackTrace();
}
rr=Float.parseFloat(str);
c1.setRadius(rr);
float Area=c1.getArea();
System.out.println("圆的半径="+c1.getRadius()+" 面积="+Area);
}
}

标签:,rr,float,System,Circle,c1,public
From: https://www.cnblogs.com/mm-ll-hh/p/18433117

相关文章