Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Rectangle Rect = new Rectangle();

             Rect.setWidth(5);
             Rect.setHeight(7);

             // 打印对象的面积
             Console.WriteLine("总面积: {0}",  Rect.getArea());
             Console.ReadKey();
        }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     Rectangle Rect = new Rectangle();
     int area;
     Rect.setWidth(5);
     Rect.setHeight(7);
     area = Rect.getArea();
     // Print the area of the object.
     Console.WriteLine("Total area: {0}", Rect.getArea());
     Console.WriteLine("Total paint cost: ${0}", Rect.getCost(area));
     Console.ReadKey();
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Rectangle Rect = new Rectangle();

            Rect.setWidth(5);

            Rect.setHeight(7);

            Console.WriteLine("Total area: {0}", Rect.getArea());

            Console.ReadKey();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Rectangle Rect = new Rectangle();

            Rect.setSide(5);
            Rect.setSide1(6);
            Rect.setHeight(4);

            // Print the area of the object.
            Console.WriteLine("Total area: {0}", Rect.getArea());
            Console.ReadKey();
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Rectangle Rect = new Rectangle();
            int       area;

            Rect.setWidth(5);
            Rect.setHeight(7);
            area = Rect.getArea();
            // Print the area of the object.
            Console.WriteLine("Total area: {0}", Rect.getArea());
            Console.WriteLine("Total paint cost: ${0}", Rect.getCost(area));
            Console.ReadKey();
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            Rectangle Rect = new Rectangle();
            int       area;

            Rect.setWidth(5);
            Rect.setHeight(7);
            area = Rect.getArea();
            // 打印对象的面积
            Console.WriteLine("总面积: {0}", Rect.getArea());
            Console.WriteLine("油漆总成本: ${0}", Rect.getCost(area));
            Console.ReadKey();
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            //Instantiation of derived class creating space in memory and giving back reference pointer to this object
            Rectangle Rect = new Rectangle();

            //Rectangle using setter methods from the base class to set the values of inherited data members
            Rect.setWidth(5);
            Rect.setHeight(7);

            // Print the area of the object.
            Console.WriteLine("Total area: {0}", Rect.getArea());
            Console.ReadKey();
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            Rectangle Rect = new Rectangle();
            int       x, y;

            Console.WriteLine("Enter width of rectangle: ");
            string tempX = Console.ReadLine();

            int.TryParse(tempX, out x);
            Console.WriteLine("Enter heigh of rectangle: ");
            string tempY = Console.ReadLine();

            int.TryParse(tempY, out y);
            Rect.setWidth(x);
            Rect.setHeight(y);

            // Print the area of the object.
            Console.WriteLine("Total area: {0}", Rect.getArea());
            Console.ReadKey();
        }