Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Rectangle r1     = new Rectangle(10, 15);
            double    r1Area = r1.Area();

            Console.WriteLine($"The area of r1 is {r1Area.ToString("n1")}");
            Rectangle r2 = new Rectangle(7, 8);

            Console.WriteLine($"The area of r2 is {r2.Area().ToString("n1")}");

            Console.WriteLine($"The area of this rectangle is {new Rectangle(5, 5).Area()}");

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Rectangle r1     = new Rectangle(10, 15);
            double    r1Area = r1.Area();

            Console.WriteLine("The area of r1 is " + r1Area.ToString("n1"));

            //OR you can do it like this
            Rectangle r2 = new Rectangle(7, 8);

            Console.WriteLine("The area of r2 is " + r2.Area().ToString("n1"));

            //OR you can do it all on one line Probably never do this
            Console.WriteLine("The area of this new rectangle is " + new Rectangle(5, 5).Area());



            Console.ReadKey();
        }
Ejemplo n.º 3
0
 static void OutputAreaofRect(Rectangle r)
 {
     Console.WriteLine($"The rectangle with {r.Length} length and {r.Width} width has an area of {r.Area()}");
 }