public void TestStaticRectangleSquare() { Coordinate leftUpCoordinate = new Coordinate(0, 5); Coordinate rightDownCoordinate = new Coordinate(5, 0); double expected = 25; double actual = StaticRectangle.Square(leftUpCoordinate, rightDownCoordinate); Assert.AreEqual(expected, actual); }
public static void RunFirstHomeWork() { Console.WriteLine("-------------------- HomeWork 1 ---------------------------"); // HomeWork 1 Console.WriteLine("Task-1 (HW - 1)"); // Task - 1 Console.Write("Input left up X coordinate: "); InputUserData(out int leftUpX, "Input left up X coordinate: "); Console.Write("Input left up Y coordinate: "); InputUserData(out int leftUpY, "Input left up Y coordinate: "); Coordinate leftUpCoordinate = new Coordinate(leftUpX, leftUpY); Console.Write("Input rigt down X coordinate: "); InputUserData(out int rightDownX, "Input rigt down X coordinate: "); Console.Write("Input right down Y coordinate: "); InputUserData(out int rightDownY, "Input rigt down Y coordinate: "); Coordinate rightDownCoordinate = new Coordinate(rightDownX, rightDownY); HomeWork_1.Rectangle rectangle = new HomeWork_1.Rectangle(leftUpCoordinate, rightDownCoordinate); Console.Write("Perimetr: "); Console.WriteLine(rectangle.Perimetr()); Console.Write("Square: "); Console.WriteLine(rectangle.Square()); Console.ReadKey(); Console.WriteLine("Task-2 (HW - 2)"); // Task - 2 Console.Write("Input left up X coordinate: "); InputUserData(out int leftUpX2, "Input left up X coordinate: "); Console.Write("Input left up Y coordinate: "); InputUserData(out int leftUpY2, "Input left up Y coordinate: "); Coordinate leftUpCoordinate2 = new Coordinate(leftUpX2, leftUpY2); Console.Write("Input rigt down X coordinate: "); InputUserData(out int rightDownX2, "Input rigt down X coordinate: "); Console.Write("Input right down Y coordinate: "); InputUserData(out int rightDownY2, "Input rigt down Y coordinate: "); Coordinate rightDownCoordinate2 = new Coordinate(rightDownX2, rightDownY2); PropertyBasedRectangle rectangle2 = new PropertyBasedRectangle(leftUpCoordinate2, rightDownCoordinate2); Console.Write("Perimetr: "); Console.WriteLine(rectangle2.Perimetr); Console.Write("Square: "); Console.WriteLine(rectangle2.Square); Console.ReadKey(); Console.WriteLine("Task-3 (HW - 3)"); // Task - 3 Circle circle = new Circle(); Console.Write("Input radius: "); InputUserData(out double radius, "Input radius: "); Console.Write("Square = "); Console.WriteLine(circle.Square(radius)); Console.Write("Length = "); Console.WriteLine(circle.Length(radius)); Console.ReadKey(); Console.WriteLine("Task-4 (HW - 4)"); // Task - 4 //Test static class Rectangle Console.Write("Input left up X coordinate: "); InputUserData(out int leftUpX4, "Input left up X coordinate: "); Console.Write("Input left up Y coordinate: "); InputUserData(out int leftUpY4, "Input left up Y coordinate: "); Coordinate leftUpCoordinate4 = new Coordinate(leftUpX4, leftUpY4); Console.Write("Input rigt down X coordinate: "); InputUserData(out int rightDownX4, "Input rigt down X coordinate: "); Console.Write("Input right down Y coordinate: "); InputUserData(out int rightDownY4, "Input rigt down Y coordinate: "); Coordinate rightDownCoordinate4 = new Coordinate(rightDownX4, rightDownY4); Console.Write("Perimetr: "); Console.WriteLine(StaticRectangle.Perimetr(leftUpCoordinate4, rightDownCoordinate4)); Console.Write("Square: "); Console.WriteLine(StaticRectangle.Square(leftUpCoordinate4, rightDownCoordinate4)); //Test static class Circle Console.Write("Input radius: "); InputUserData(out double radius4, "Input radius: "); Console.Write("Square = "); Console.WriteLine(StaticCircle.Square(radius4)); Console.Write("Length = "); Console.WriteLine(StaticCircle.Length(radius4)); Console.ReadKey(); Console.WriteLine("Task-5 (HW - 5)"); // Task - 5 Console.Write("Input real part: "); InputUserData(out double realFirst, "Input real part: "); Console.Write("Input imaginary part: "); InputUserData(out double imaginaryFirst, "Input imaginary part: "); ComplexNumber firstComplex = new ComplexNumber(realFirst, imaginaryFirst); Console.Write("Input real part: "); InputUserData(out double realSecond, "Input real part: "); Console.Write("Input imaginary part: "); InputUserData(out double imaginarySecond, "Input imaginary part: "); ComplexNumber secondComplex = new ComplexNumber(realSecond, imaginarySecond); ComplexNumber multiplyingResult = firstComplex * secondComplex; Console.WriteLine(multiplyingResult.ToString()); ComplexNumber dividingResult = firstComplex / secondComplex; Console.WriteLine(dividingResult.ToString()); Console.ReadKey(); }