Example #1
0
        static void Main(string[] args)
        {
            Retangulo r;

            r = new Retangulo();

            Console.WriteLine("Digite os valores do retângulo: ");
            Console.Write("Digite a largura do retângulo: ");
            r.largura = double.Parse(Console.ReadLine(), CultureInfo.InstalledUICulture);

            Console.Write("Digite a altura do retângulo: ");
            r.altura = double.Parse(Console.ReadLine(), CultureInfo.InstalledUICulture);

            Console.WriteLine("AREA = " + r.area().ToString("F2", CultureInfo.InvariantCulture));
            Console.WriteLine("PERIMETRO = " + r.perimetro().ToString("F2", CultureInfo.InvariantCulture));
            Console.WriteLine("DIAGONAL = " + r.diagonal().ToString("F2", CultureInfo.InvariantCulture));
            Console.ReadLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            //Instancia do objeto
            Retangulo ret = new Retangulo();

            //Leitura dos dados
            Console.Write("Informe a largura do retangulo: ");
            ret.largura = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
            Console.Write("Informe a altura do retangulo: ");
            ret.altura = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            //Apresentacao dos resultados
            Console.WriteLine("AREA = " + ret.area().ToString("F2", CultureInfo.InvariantCulture));
            Console.WriteLine("PERIMETRO = " + ret.perimetro().ToString("F2", CultureInfo.InvariantCulture));
            Console.WriteLine("DIAGONAL = " + ret.diagonal().ToString("F2", CultureInfo.InvariantCulture));

            Console.ReadLine();
        }