public static void Main() { Circle circle = new Circle(5); Console.WriteLine(circle.ToString()); Rectangle rectangle = new Rectangle(2, 3); Console.WriteLine(rectangle.ToString()); }
private static void Main() { Circle circle = new Circle(5); Console.WriteLine("I am a circle. " + circle.ToString()); Rectangle rect = new Rectangle(2, 3); Console.WriteLine("I am a rectangle. " + rect.ToString()); }
private static void Main() { var circle = new Circle(5); Console.WriteLine(circle.ToString()); var rect = new Rectangle(2, 3); Console.WriteLine(rect.ToString()); }
public static void Main() { double radius = 5; Circle circle = new Circle(radius); Console.WriteLine(circle.ToString()); double width = 2; double height = 3; Rectangle rectangle = new Rectangle(width, height); Console.WriteLine(rectangle.ToString()); }
public static void Main() { Circle circle = new Circle(5); string circleInfo = circle.ToString(); Console.WriteLine(circleInfo); Rectangle rect = new Rectangle(7, 3); string rectInfo = rect.ToString(); Console.WriteLine(rectInfo); }
public static void Main() { Circle circle = new Circle(5); //Console.WriteLine("I am a circle. " + "My perimeter is {0:f2}. My surface is {1:f2}.", circle.Perimeter(), circle.Area()); Rectangle rect = new Rectangle(2, 3); //Console.WriteLine("I am a rectangle. " + "My perimeter is {0:f2}. My surface is {1:f2}.", rect.Perimeter(), rect.Area()); Console.WriteLine(circle.ToString()); Console.WriteLine(rect.ToString()); //not required for the homework List<IFigure> figures = new List<IFigure>(); figures.Add(circle); figures.Add(rect); foreach (var figure in figures) { Console.WriteLine(figure.Area()); } }