示例#1
0
 /// <summary>
 /// Constructor with a square, "squarebase", and a double, "height", to base this pyramid off of
 /// </summary>
 /// <param name="squareBase"></param>
 /// <param name="height"></param>
 public SquarePyramid(Square squareBase, double height)
 {
     _squareBase = squareBase;
     _height     = height < 0 ? 0 : height;
 }
示例#2
0
 /// <summary>
 /// Constructor with two doubles, "length" and "height", to base this pyramid off of
 /// </summary>
 /// <param name="length"></param>
 /// <param name="height"></param>
 public SquarePyramid(double length, double height)
 {
     _squareBase = new Square(length);
     _height     = height < 0 ? 0 : height;
 }
示例#3
0
        public void SquareTest()
        {
            Square square = new Square(5);

            Assert.AreEqual(5, square.Length);
            Assert.AreEqual(25, square.Area);
            Assert.AreEqual(20, square.Perimeter);

            Square square2 = new Square(5);

            Assert.AreEqual(square, square2);
        }
示例#4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(Square other)
 {
     return other != null && Math.Abs(_length - other._length) < 1;
 }
示例#5
0
 /// <summary>
 /// Constructor with a double, "length", to make the Cube equal to
 /// </summary>
 /// <param name="length"></param>
 public Cube(double length)
 {
     _squareBase = new Square(length);
 }
示例#6
0
 /// <summary>
 /// Constructor with a specified Square, "squareBase", to base the Cube off of
 /// </summary>
 /// <param name="squareBase"></param>
 public Cube(Square squareBase)
 {
     _squareBase = squareBase;
 }
示例#7
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public Cube()
 {
     _squareBase = new Square();
 }
示例#8
0
 /// <summary>
 /// Constructor with two doubles, "length" and "height", to base this pyramid off of
 /// </summary>
 /// <param name="length"></param>
 /// <param name="height"></param>
 public SquarePyramid(double length, double height)
 {
     _squareBase = new Square(length);
     _height = height < 0 ? 0 : height;
 }
示例#9
0
 /// <summary>
 /// Constructor with a square, "squarebase", and a double, "height", to base this pyramid off of
 /// </summary>
 /// <param name="squareBase"></param>
 /// <param name="height"></param>
 public SquarePyramid(Square squareBase, double height)
 {
     _squareBase = squareBase;
     _height = height < 0 ? 0 : height;
 }