static void Main() { Circle circle; Triangle triangle; Trapeze trapeze; Square square; Rectangle rectangle; { string input = Console.ReadLine(); string[] array = input.Split(' '); double a = Convert.ToDouble(array[0]); double b = Convert.ToDouble(array[1]); double c = Convert.ToDouble(array[2]); circle = new Circle(c); triangle = new Triangle(c, a); trapeze = new Trapeze(a, b, c); square = new Square(b); rectangle = new Rectangle(a, b); } Console.WriteLine("TRIANGULO: {0:0.000}", triangle.Area()); Console.WriteLine("CIRCULO: {0:0.000}", circle.Area()); Console.WriteLine("TRAPEZIO: {0:0.000}", trapeze.Area()); Console.WriteLine("QUADRADO: {0:0.000}", square.Area()); Console.WriteLine("RETANGULO: {0:0.000}", rectangle.Area()); }
public static Trapeze SetTrapeze(out string name, out string type, out double a, out double b, out double c, out double d, out double h, out double area, out double perim, out int tops, out int edges) { Console.Write("Set Name of Trapeze: "); name = Console.ReadLine(); Console.Write("Set Type of Trapeze: "); type = Console.ReadLine(); Console.Write("Enter a side of Trapeze:\n"); Console.Write("a: "); a = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter b side of Trapeze:\n"); Console.Write("b: "); b = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter c side of Trapeze:\n"); Console.Write("c: "); c = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter d side of Trapeze:\n"); Console.Write("d: "); d = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter h of Trapeze:\n"); Console.Write("h: "); h = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Trapeze trapeze = new Trapeze(a, b, c, d, h); trapeze.Name = name; trapeze.Type = type; area = trapeze.Area(); perim = trapeze.Perimeter(); tops = trapeze.QuantityOfTops(); edges = trapeze.QuantityOfEdges(); return(trapeze); }