展开全部
public class Trapezoidal {
private float top;
private float bottom;
private float height;
private float area;
public float getTop() {
return top;
}
public void setTop(float top) {
this.top = top;
}
public float getBottom() {
return bottom;
}
public void setBottom(float bottom) {
this.bottom = bottom;
}
public float getHeight() {
return height;
}
public void setHeight(float height) {
this.height = height;
}
public float getArea(){
this.area=((getTop()+getBottom())*getHeight())/2;
return area;
}
}
private float top;
private float bottom;
private float height;
private float area;
public float getTop() {
return top;
}
public void setTop(float top) {
this.top = top;
}
public float getBottom() {
return bottom;
}
public void setBottom(float bottom) {
this.bottom = bottom;
}
public float getHeight() {
return height;
}
public void setHeight(float height) {
this.height = height;
}
public float getArea(){
this.area=((getTop()+getBottom())*getHeight())/2;
return area;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询