编一个java应用程序。程序中有3个类:Trangle、Trapezoid和Circle,用来刻画“三角形”、“梯形”和“圆形
答案:1 悬赏:20 手机版
解决时间 2021-11-25 08:22
- 提问者网友:niaiwoma
- 2021-11-24 18:06
编一个java应用程序。程序中有3个类:Trangle、Trapezoid和Circle,用来刻画“三角形”、“梯形”和“圆形
最佳答案
- 五星知识达人网友:轻雾山林
- 2021-11-24 19:12
public class Triangle
{
private double edge1;
private double edge2;
private double edge3;
public Triangle(double edge1,double edge2,double edge3)
{
this.edge1=edge1;
this.edge2=edge2;
this.edge3=edge3;
}
public double getEdge1() {
return edge1;
}
public void setEdge1(double edge1) {
this.edge1 = edge1;
}
public double getEdge2() {
return edge2;
}
public void setEdge2(double edge2) {
this.edge2 = edge2;
}
public double getEdge3() {
return edge3;
}
public void setEdge3(double edge3) {
this.edge3 = edge3;
}
}
class Trapezoid
{
private double upedge;
private double downedge;
private double height;
public Trapezoid(double upedge,double downedge,double height)
{
this.upedge=upedge;
this.downedge=downedge;
this.height=height;
}
public double getUpedge() {
return upedge;
}
public void setUpedge(double upedge) {
this.upedge = upedge;
}
public double getDownedge() {
return downedge;
}
public void setDownedge(double downedge) {
this.downedge = downedge;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
}
class Circle
{
private double radius;
public Circle(double radius)
{
this.radius=radius;
}
public double getRadius() {
return radius;
}
public void setRadius(double radius) {
this.radius = radius;
}
}
{
private double edge1;
private double edge2;
private double edge3;
public Triangle(double edge1,double edge2,double edge3)
{
this.edge1=edge1;
this.edge2=edge2;
this.edge3=edge3;
}
public double getEdge1() {
return edge1;
}
public void setEdge1(double edge1) {
this.edge1 = edge1;
}
public double getEdge2() {
return edge2;
}
public void setEdge2(double edge2) {
this.edge2 = edge2;
}
public double getEdge3() {
return edge3;
}
public void setEdge3(double edge3) {
this.edge3 = edge3;
}
}
class Trapezoid
{
private double upedge;
private double downedge;
private double height;
public Trapezoid(double upedge,double downedge,double height)
{
this.upedge=upedge;
this.downedge=downedge;
this.height=height;
}
public double getUpedge() {
return upedge;
}
public void setUpedge(double upedge) {
this.upedge = upedge;
}
public double getDownedge() {
return downedge;
}
public void setDownedge(double downedge) {
this.downedge = downedge;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
}
class Circle
{
private double radius;
public Circle(double radius)
{
this.radius=radius;
}
public double getRadius() {
return radius;
}
public void setRadius(double radius) {
this.radius = radius;
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯