class Cuboid:
def __init__(self, length, width, height):
# 创建实例属性
self.length = length
self.width = width
self.height = height
# 表面积函数
def area(self):
print("表面积为%d平方米" % (self.length * self.width * 2 + self.length * self.height * 2 + self.width * self.height * 2))
# 体积函数
def volume(self):
print("体积为%d立方米" % (self.length * self.width * self.height))
if __name__ == '__main__':
x = int(input("请输入长:"))
y = int(input("请输入宽:"))
z = int(input("请输入高:"))
cuboid = Cuboid(x, y, z) # 实例化类
cuboid.area()
cuboid.volume()