class Program
{
static void Main(string[] args)
{
Cub cube = new Cub(3, 4, 5);
cube.CalcArea();
cube.CalcVolume();
cube.Print();
Console.ReadLine();
}
}
class Cub
{
public int Length { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public int Volume { get; set; }
public int SuperficialArea { get; set; }
public Cub(int length, int width, int height)
{
this.Length = length;
this.Width = width;
this.Height = height;
}
public void CalcVolume()
{
Volume = Length * Width * Height;
}
public void CalcArea()
{
SuperficialArea = 2 * (Length * Width + Width * Height + Length * Height);
}
public void Print()
{
Console.WriteLine("表面积为:{0},体积为:{1}", SuperficialArea, Volume);
}
}
大小写什么的,名字什么的你自己看着改改就行了