import java.io.;
public class Z2_3_Circle{
// final float PI = 3.14159f;
float r;
float l;
public void setRadius(float r1){
r = r1;
}
public void setArclength(float l1){
l = l1;
}
public float getRadius(){
return r;
}
public float getArclength(){
return l;
}
public float getArea(){
return (rl)/2;
}
public static void main(String[] args){
Z2_3_Circle c1 = new Z2_3_Circle();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String strR = null;
String strL = null;
float rr;
float ll;
System.out.println("Please enter a radius:");
System.out.println("Please enter the arc length:");
try{
strR = br.readLine();
strL = br.readLine();
}catch(IOException e){
e.printStackTrace();
}
rr = Float.parseFloat(strR);
ll = Float.parseFloat(strL);
c1.setRadius(rr);
c1.setArclength(ll);
float Area = c1.getArea();
System.out.println("Radius=" + c1.getRadius() +"\n"+"arc length=" + c1.getArclength() + "\n"+"area=" +Area);
}
}
标签:String,float,System,扇形,Circle,简单,c1,计算公式,public From: https://www.cnblogs.com/Chang-8846/p/18433203