Esempio n. 1
0
        public static void Task3()
        {
            Console.Write("Radius: ");
            double radius = Convert.ToDouble(Console.ReadLine());

            CircleTask3 circ = new CircleTask3();

            Console.WriteLine("Length: {0}; Square: {1}", circ.Length(radius), circ.Square(radius));
            Console.ReadKey();
        }
Esempio n. 2
0
        public static void Hw1()
        {
            Console.WriteLine("\n----- HomeWork 1 -----");
            Console.WriteLine("\n--- Task1 Rectangle ---");

            Console.Write("LeftY: ");
            double LeftY = Convert.ToDouble(Console.ReadLine());

            Console.Write("LeftX: ");
            double LeftX = Convert.ToDouble(Console.ReadLine());

            Console.Write("RighY: ");
            double RightY = Convert.ToDouble(Console.ReadLine());

            Console.Write("RightX: ");
            double RightX = Convert.ToDouble(Console.ReadLine());

            HW1.RectangleTask1 rect1 = new HW1.RectangleTask1(LeftY, LeftX, RightY, RightX);

            Console.WriteLine("Square: {0}; Perimeter: {1};", rect1.Square(), rect1.Perimetеr());

            Console.WriteLine("\n--- Task2 Rectangle ---");

            HW1.RectangleTask2 rect2 = new HW1.RectangleTask2(LeftY, LeftX, RightY, RightX);

            Console.WriteLine("Square: {0}; Perimeter: {1};", rect2.Square, rect2.Perimetеr);

            Console.WriteLine("\n--- Task3 Circle ---");
            Console.Write("Radius: ");
            double radius3 = Convert.ToDouble(Console.ReadLine());

            HW1.CircleTask3 circ = new HW1.CircleTask3();

            Console.WriteLine("Length: {0}; Square: {1}", circ.Length(radius3), circ.Square(radius3));

            Console.WriteLine("--- Task4 Rectangle ---");
            Console.Write("LeftY: ");
            double LeftY4 = Convert.ToDouble(Console.ReadLine());

            Console.Write("LeftX: ");
            double LeftX4 = Convert.ToDouble(Console.ReadLine());

            Console.Write("RighY: ");
            double RightY4 = Convert.ToDouble(Console.ReadLine());

            Console.Write("RightX: ");
            double RightX4 = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Square: {0}; Perimeter: {1};", HW1.RectangleTask4.Square(LeftY4, LeftX4, RightY4, RightX4), HW1.RectangleTask4.Perimeter(LeftY4, LeftX4, RightY4, RightX4));

            Console.WriteLine("--- Task4 Circle ---");
            Console.Write("Radius: ");
            double radius4 = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Length: {0}; Square: {1};", HW1.CircleTask4.Length(radius4), HW1.CircleTask4.Square(radius4));

            Console.WriteLine("--- Task5 Complex Number ---");

            double real, imaginary;

            HW1.ComplexNumberTask5 numb1, numb2 = new HW1.ComplexNumberTask5();

            Console.Write("First Real: ");
            real = Convert.ToDouble(Console.ReadLine());

            Console.Write("First Imaginary: ");
            imaginary = Convert.ToDouble(Console.ReadLine());

            numb1 = new HW1.ComplexNumberTask5(real, imaginary);

            Console.Write("Second Real: ");
            real = Convert.ToDouble(Console.ReadLine());

            Console.Write("Second Imaginary: ");
            imaginary = Convert.ToDouble(Console.ReadLine());

            numb2 = new HW1.ComplexNumberTask5(real, imaginary);

            HW1.ComplexNumberTask5 numb3 = numb1 * numb2;

            Console.WriteLine("Multiplication: ");
            Console.WriteLine($"numb1 = {numb3.Real} + i * {numb3.Imaginary}");
            HW1.ComplexNumberTask5 numb4 = numb1 / numb2;

            Console.WriteLine("Division: ");
            Console.WriteLine($"numb2 = {numb4.Real} + i * {numb4.Imaginary}");
        }