static void Main(string[] args) { Triangle triangle = new Triangle(5, 3); Square square = new Square(5, 5); //Use a collection of Shape objects and display their dimensions and area. triangle.CalculateArea(); triangle.DisplayShapeData(); square.CalculateArea(); square.DisplayShapeData(); }
static void Main(string[] args) { var circle = new Circle(5); Console.WriteLine(circle.CalculateArea()); Console.WriteLine(circle.CapculatePerimeter()); var triangle = new Triangle(2, 2); Console.WriteLine(triangle.CalculateArea()); Console.WriteLine(triangle.CapculatePerimeter()); var rectangle = new Rectangle(3, 3); Console.WriteLine(rectangle.CalculateArea()); Console.WriteLine(rectangle.CapculatePerimeter()); }
public void TestTriangleCalculateArea() { Triangle r = new Triangle(2.1, 39); Assert.AreEqual(40.95, r.CalculateArea()); }