示例#1
0
    public static void Main(string[] args)
    {
        Console.WriteLine("\nCalculando Area e Diagonal de um retangulo ...");
        Console.WriteLine("Informe a Base");
        double b = double.Parse(Console.ReadLine());

        Console.WriteLine("Informe a Altura");
        double h = double.Parse(Console.ReadLine());

        Retangulo r = new Retangulo(b, h);

        Console.WriteLine("---------------------------\n");
        Console.WriteLine($"Base: {r.GetBase():0.00}");
        Console.WriteLine($"Altura: {r.GetAltura():0.00}");
        Console.WriteLine($"Area: {r.CalcArea():0.00}");
        Console.WriteLine($"Diagonal: {r.CalcDiagonal():0.00}");

        Console.WriteLine("---------------------------\n");
        r.SetBase(b * 2);
        r.SetAltura(h * 3);
        Console.WriteLine($"Valores modificados para:\n{r}");
        Console.WriteLine($"Area: {r.CalcArea():0.00}");
        Console.WriteLine($"Diagonal: {r.CalcDiagonal():0.00}");

        Console.WriteLine("---------------------------\n");

        return;
    }