代码拉取完成,页面将自动刷新
using System;
namespace BoxApplication
{
class Box
{
private double length;
private double breadth;
private double height;
public void SetLength(double len)
{
length = len;
}
public void SetBreadth(double bre)
{
breadth = bre;
}
public void SetHeight(double hei)
{
height = hei;
}
public double GetVolume()
{
return length * breadth * height;
}
}
class Boxtester
{
static void Main(string[] args)
{
Box box1 = new Box();
Box box2 = new Box();
double volume;
box1.SetLength(6.0);
box1.SetBreadth(7.0);
box1.SetHeight(5.0);
box2.SetLength(12.0);
box2.SetBreadth(13.0);
box2.SetHeight(10.0);
volume = box1.GetVolume();
Console.WriteLine("box1 的体积:{0}", volume);
volume = box2.GetVolume();
Console.WriteLine("box2 的体积:{0}", volume);
Console.ReadKey();
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。