public static void Main(string[] args) { // case 1 Console.WriteLine("Case1**************"); RectangleCase1 rect = new RectangleCase1 { Height = 5, Width = 10 }; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("React Are: " + AreaCalculatorCase1.Area(rect)); rect = new SquareCase1 { Height = 5, Width = 10 }; Console.WriteLine("Square Are: " + AreaCalculatorCase1.Area(rect)); Console.ResetColor(); Console.ReadKey(); }
public static int Area(RectangleCase1 rect) { return rect.Height * rect.Width; }