Пример #1
0
        static void Main(string[] args)
        {
            Circle myCircle = new Circle();
            myCircle.Radius = 5;

            Rectangle myRectangle = new Rectangle();
            myRectangle.Height = 5;
            myRectangle.Width = 3;

            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("Rectangle is currently {0} x {1}.  The perimeter is {2}",
                                myRectangle.Width,
                                myRectangle.Height,
                                myRectangle.getPerimeter());

                Console.WriteLine("Circle radius is currently {0}.  The perimeter is {1}",
                    myCircle.Radius,
                    myCircle.getPerimeter());

                myCircle.scale(myCircle);
                myRectangle.scale(myRectangle);
            }
            Console.ReadLine();
        }
Пример #2
0
 private static void rectangleTest()
 {
     Rectangle r = new Rectangle(2, 2) + new Rectangle(5, 1);
     d("Rectangle area: " + r.area());
     Square s = new Square(3);
     d("Square area: " + s.area());
 }
Пример #3
0
 public static void Test()
 {
     Shape s = new Rectangle { 幅 = 2, 高さ = 3 };
     Shape t = new Circle { 半径 = 2 };
     Console.WriteLine(s.Contains(t));
     Console.WriteLine(t.Contains(s));
 }
Пример #4
0
 static void Main(string[] args)
 {
     Console.WriteLine("Enter the length");
     Rectangle rectangle = new Rectangle();
     long a, b;
     a = (long)Convert.ToDouble(Console.ReadLine());
     Console.WriteLine("Enter the width");
     b = (long)Convert.ToDouble(Console.ReadLine());
     rectangle.calculateArea( a, b);
     Console.ReadKey();
 }
Пример #5
0
        public Rectangle(Rectangle rectangle)
            : this(rectangle.UpperLeft, rectangle.lowerLeft)
        {

        }
Пример #6
0
 static void Main(string[] args)
 {
     Caller c = new Caller();
      Rectangle r = new Rectangle(10, 7);
      Triangle t = new Triangle(10, 5);
      c.CallArea(r);
      c.CallArea(t);
      Console.ReadKey();
 }
Пример #7
0
 static bool Contains(Circle s, Rectangle t)
 {
     return s.半径 * s.半径 * 4 > t.幅 * t.幅 + t.高さ * t.高さ;
 }
Пример #8
0
 static bool Contains(Rectangle s, Circle t)
 {
     return s.幅 * s.幅 + s.高さ * s.高さ > t.半径 * t.半径 * 4;
 }
Пример #9
0
 static bool Contains(Rectangle s, Rectangle t)
 {
     return s.幅 > t.幅 && s.高さ > t.高さ;
 }
Пример #10
0
 static double GetArea(Rectangle x) { return x.幅 * x.高さ; }