Java 实现柱体体积计算:周长乘高加两倍面积
public class Column extends Rectangle { int height; public Column(int length, int wide, int height) { super(length, wide); this.height = height; } public void surfaceArea() { } public void volume() { int perimeter = (length + wide) * 2; int area = length * wide; int volume = perimeter * height + 2 * area; System.out.println("周长乘高加上两倍的面积为:" + volume); } }
原文地址: https://www.cveoy.top/t/topic/pA2I 著作权归作者所有。请勿转载和采集!