/// <summary>
 /// Constructor with two doubles, "radius" and "height", to base this cylinder off of
 /// </summary>
 /// <param name="radius"></param>
 /// <param name="height"></param>
 public RightCircularCylinder(double radius, double height)
 {
     _circleBase = new Circle(radius);
     _height = height < 0 ? 0 : height;
 }
        public void CircleTest()
        {
            Circle circle = new Circle(3);

            Assert.AreEqual(3, circle.Radius);
            Assert.AreEqual(28.274334, Math.Round(circle.Area, 6));
            Assert.AreEqual(18.849556, Math.Round(circle.Circumference, 6));
            Assert.AreEqual(18.849556, Math.Round(circle.Perimeter, 6));
            Assert.AreEqual(6, circle.Diameter);

            circle.Diameter = 10;
            Assert.AreEqual(5, circle.Radius);

            Circle circle2 = new Circle(5);

            Assert.AreEqual(circle, circle2);
        }
 /// <summary>
 /// Constructor with a Circle, "circleBase", and a double, "height", to base this cylinder off of
 /// </summary>
 /// <param name="circleBase"></param>
 /// <param name="height"></param>
 public RightCircularCylinder(Circle circleBase, double height)
 {
     _circleBase = circleBase;
     _height = height < 0 ? 0 : height;
 }
Exemple #4
0
 /// <summary>
 /// Checks to see if "_radius" is equal to "other"'s "_radius"
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(Circle other)
 {
     return other != null && Math.Abs(_radius - other._radius) < 1;
 }