/// <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; }
/// <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; }
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); }
/// <summary> /// /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(Square other) { return other != null && Math.Abs(_length - other._length) < 1; }
/// <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); }
/// <summary> /// Constructor with a specified Square, "squareBase", to base the Cube off of /// </summary> /// <param name="squareBase"></param> public Cube(Square squareBase) { _squareBase = squareBase; }
/// <summary> /// Default constructor /// </summary> public Cube() { _squareBase = new Square(); }