Пример #1
0
        public void CircleSquareCheck()
        {
            double radius = 4;

            double expected = Math.PI * Math.Pow(radius, 2);
            double actual   = GeometryLib.GetSquare(radius);

            Assert.AreEqual(expected, actual, 0.001, "Square uncorrect");
        }
Пример #2
0
        public void TriangleSquareCheck()
        {
            double a = 4, b = 5, c = 6;
            double p        = (a + b + c) / 2;
            double expected = Math.Sqrt(p * (p - a) * (p - b) * (p - c));
            double actual   = GeometryLib.GetSquare(a, b, c);

            Assert.AreEqual(expected, actual, 0.001, "Square uncorrect");
        }
Пример #3
0
    static void Main(string[] args)
    {
        Console.WriteLine("Введите параметры");

        string[] paramList = Console.ReadLine().Split();
        double   square;
        bool     isRight = false;

        if (paramList.Length == 1)
        {
            square = GeometryLib.GetSquare(double.Parse(paramList[0]));
        }
        else
        {
            square  = GeometryLib.GetSquare(double.Parse(paramList[0]), double.Parse(paramList[1]), double.Parse(paramList[2]));
            isRight = GeometryLib.IsRightTriangle(double.Parse(paramList[0]), double.Parse(paramList[1]), double.Parse(paramList[2]));
        }

        Console.WriteLine(square);
        Console.WriteLine(isRight);
    }