十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
public class Ring {
成都创新互联从2013年成立,是专业互联网技术服务公司,拥有项目成都网站设计、网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元八宿做网站,已为上家服务,为八宿各地企业和个人服务,联系电话:028-86922220
double innerRadius;
double outerRadius;
String color;
public Ring(double innerRadius,double outerRadius){
this.innerRadius=innerRadius;
this.outerRadius=outerRadius;
}
double area(){
return Math.PI*(Math.pow(outerRadius, 2)-Math.pow(innerRadius, 2));
}
public static void main(String args){
Ring r=new Ring(5,4);
System.out.println(r.area());
}
}
public class Ring
{
private double innerR;
private double outR;
public void setDate(double outR)
{
this.outR = outR;
}
public double getArea()
{
return Math.PI*outR*outR;
}
public static void main(String[] args)
{
Ring ring1 = new Ring();
ring1.setDate(2);
Ring ring2 = new Ring();
ring2.setDate(4);
System.out.println("第一个环面积为:" + ring1.getArea());
System.out.println("第二个环面积为:" + ring2.getArea());
}
}
public class Ring {
private double outerRadius;
private double innerRadius;
private String color;
public Ring() {
}
public Ring(double outerRadius, double innerRadius, String color) {
this.outerRadius = outerRadius;
this.innerRadius = innerRadius;
this.color = color;
}
public double getOuterRadius() {
return outerRadius;
}
public void setOuterRadius(double outerRadius) {
this.outerRadius = outerRadius;
}
public double getInnerRadius() {
return innerRadius;
}
public void setInnerRadius(double innerRadius) {
this.innerRadius = innerRadius;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public double getArea(){
//计算环形面积
double outer = Math.PI * Math.pow(outerRadius, 2);
double inner = Math.PI * Math.pow(innerRadius, 2);
return outer - inner;
}
}