Example #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;
 }
Example #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;
 }
Example #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);
        }
Example #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(Square other)
 {
     return other != null && Math.Abs(_length - other._length) < 1;
 }
Example #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);
 }
Example #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;
 }
Example #7
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public Cube()
 {
     _squareBase = new Square();
 }
Example #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;
 }
Example #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;
 }