package test;
// 边
public class Border {
// 长度
private int length;
// 粗细
private int bold;
public int getBold() {
return bold;
}
public void setBold(int bold) {
this.bold = bold;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
}
package test;
// 抽象图形类
public abstract class Graphics {
private Border[] borders;
public Border[] getBorders() {
return borders;
}
public void setBorders(Border[] borders) {
this.borders = borders;
}
// 计算面积
public int countSpace() {
return 0;
}
}
package test;
//有规则图形
public abstract class RegularlyGraphics extends Graphics {
// 计算面积
public int countSpace() {
return 0;
}
}
package test;
// 无规则图形
public abstract class RulelessGraphics extends Graphics {
// 计算面积
public int countSpace() {
return 0;
}
}
package test;
//正方形
public class Square extends RegularlyGraphics {
// 计算面积
public int countSpace() {
return super.countSpace();
}
}
package test;
// 长方形
public class Rectangle extends RegularlyGraphics {
// 计算面积
public int countSpace() {
return super.countSpace();
}
}
package test;
//三角形
public class Triangle extends RegularlyGraphics {
// 计算面积
public int countSpace() {
// 计算三角行面积
return 0;
}
}
作业帮用户
2017-09-23
举报