static void Main(string[] args) { Point pointA = new Point(3, 4); Point pointB = new Point(6, 8); Point pointC = new Point(3, 4); Point pointD = new Point(6, 8); Rectangle firstRectangle = new Rectangle(pointA, pointB); Rectangle secondRectangle = new Rectangle(pointC, pointD); Console.WriteLine("Rectangle area is: {0}",firstRectangle.GetArea()); Console.WriteLine("Rectang;e perimeter is: {0}",firstRectangle.GetPerimeter()); Console.WriteLine(firstRectangle.ToString()); Console.WriteLine(firstRectangle.Equals(secondRectangle)); }
static void Main(string[] args) { Point pointA = new Point(3, 4); Point pointB = new Point(6, 8); Point pointC = new Point(3, 4); Point pointD = new Point(6, 8); Rectangle firstRectangle = new Rectangle(pointA, pointB); Rectangle secondRectangle = new Rectangle(pointC, pointD); Console.WriteLine("Rectangle area is: {0}", firstRectangle.GetArea()); Console.WriteLine("Rectang;e perimeter is: {0}", firstRectangle.GetPerimeter()); Console.WriteLine(firstRectangle.ToString()); Console.WriteLine(firstRectangle.Equals(secondRectangle)); }
static void Main(string[] args) { Point p1 = new Point(1.2, 2.1); Point p2 = new Point(5.4, 7.2); Console.WriteLine("{0} + {1} = {2}", p1, p2, p1 + p2); Console.WriteLine(); LineSegment ls1 = new LineSegment(new Point(1, 1), new Point(1, 5)); LineSegment ls2 = new LineSegment(new Point(2, 3), new Point(4, 5)); Console.WriteLine("{0} -> Length: {1}", ls1, ls1.GetLength()); Console.WriteLine("{0} -> Length: {1}", ls2, ls2.GetLength()); Console.WriteLine(); Rectangle rect = new Rectangle(p1, p2); Rectangle rect2 = new Rectangle(p2, p1); Console.WriteLine("Is {0} equal to {1} -> {2}", rect, rect2, rect.Equals(rect2)); Console.WriteLine(); Console.WriteLine("Rectangle from {0} and {1} has these properties:", p1, p2); Console.WriteLine("Width: {0}", rect.Width); Console.WriteLine("Height: {0}", rect.Height); Console.WriteLine("Lower Left: {0}", rect.LowerLeftPoint); Console.WriteLine("Lower Rigth: {0}", rect.LowerRightPoint); Console.WriteLine("Upper Left: {0}", rect.UpperLeftPoint); Console.WriteLine("Upper Rigth: {0}", rect.UpperRightPoint); Console.WriteLine("Perimeter: {0}", rect.GetPerimeter()); Console.WriteLine("Area: {0}", rect.GetArea()); Console.WriteLine("Center: {0}", rect.Center); Console.WriteLine(); Vector v1 = new Vector(1, 2, 3, 4); Vector v2 = new Vector(7, 3, 8, 1); Console.WriteLine("{0} + {1} = {2}", v1, v2, v1 + v2); Console.WriteLine("{0} - {1} = {2}", v1, v2, v1 - v2); Console.WriteLine("{0} * {1} = {2}", v1, v2, v1 * v2); Console.WriteLine("{0} - {1} = {2}", v1, 0.2, v1 - 0.2); Console.WriteLine("{0} * {1} = {2}", v1, 0.2, v1 * 0.2); Console.ReadKey(); }
static void Main(string[] args) { Point point = new Point(1, 1); Point point1 = new Point(7, 3); Point point2 = new Point(1, 1); Point point3 = new Point(7, 3); //LineSegment line = new LineSegment(point, point3); //LineSegment line1 = new LineSegment(point1, point2); //Console.WriteLine(line != line1); //Console.WriteLine(line <= line1); Rectangle rect = new Rectangle(point, point1); Rectangle newRect = new Rectangle(point2, point3); Console.WriteLine("Rectangle Parameter = {0}", rect.GetParameter()); Console.WriteLine("Rectangle Area = {0}",rect.GetArea()); Console.WriteLine(rect.ToString()); Console.WriteLine(rect.Equals(newRect)); //Console.WriteLine(rect == newRect); }
static void Main(string[] args) { Point point = new Point(1, 1); Point point1 = new Point(7, 3); Point point2 = new Point(1, 1); Point point3 = new Point(7, 3); //LineSegment line = new LineSegment(point, point3); //LineSegment line1 = new LineSegment(point1, point2); //Console.WriteLine(line != line1); //Console.WriteLine(line <= line1); Rectangle rect = new Rectangle(point, point1); Rectangle newRect = new Rectangle(point2, point3); Console.WriteLine("Rectangle Parameter = {0}", rect.GetParameter()); Console.WriteLine("Rectangle Area = {0}", rect.GetArea()); Console.WriteLine(rect.ToString()); Console.WriteLine(rect.Equals(newRect)); //Console.WriteLine(rect == newRect); }
static void Main(string[] args) { Point firstPoint = new Point(5, 5); Point secondPoint = new Point(7, 7); LineSegment first = new LineSegment(firstPoint, secondPoint); LineSegment second = new LineSegment(firstPoint, secondPoint); Console.WriteLine(first > second); Console.WriteLine(first >= second); Console.WriteLine(first == second); LineSegment twoPoints = firstPoint + secondPoint; Rectangle rect = new Rectangle(firstPoint, secondPoint); Rectangle anotherRect = new Rectangle(secondPoint, firstPoint); Console.WriteLine("Equals: " + rect.Equals(anotherRect)); Console.WriteLine(); Console.WriteLine("Width: {0}", rect.GetWidth); Console.WriteLine("Height: {0}", rect.GetHeight); Console.WriteLine("Lower Left: {0}", rect.GetLowerLeftPoint); Console.WriteLine("Lower Rigth: {0}", rect.GetLowerRightPoint); Console.WriteLine("Upper Left: {0}", rect.GetUpperLeftPoint); Console.WriteLine("Upper Rigth: {0}", rect.GetUpperRightPoint); Console.WriteLine("Perimeter: {0}", rect.GetPerimeter()); Console.WriteLine("Area: {0}", rect.GetArea()); Console.WriteLine("Center: {0}", rect.GetCenterPoint); Console.WriteLine(); Vector vector = new Vector(new double[] { 1, 2, 3, 4 }); Vector anotherVector = new Vector(new double[] { 5, 6, 7, 8, 9 }); Console.WriteLine("{0} + {1} = {2}", vector, anotherVector, vector + anotherVector); Console.WriteLine("{0} - {1} = {2}", vector, anotherVector, vector - anotherVector); Console.WriteLine("{0} * {1} = {2}", vector, anotherVector, vector * anotherVector); double scalar = 0.7; Console.WriteLine("{0} - {1} = {2}", vector, scalar, vector - scalar); Console.WriteLine("{0} * {1} = {2}", vector, scalar, vector * scalar); Console.WriteLine(); }
static void TestGeometry() { Rectangle rect1 = new Rectangle(new Point(0, 0), new Point(3, 3)); Rectangle rect2 = new Rectangle(new Point(6, 6), new Point(-3, 3)); Console.WriteLine(rect1.ToString()); Console.WriteLine(rect1.GetPerimeter()); Console.WriteLine(rect1.GetArea()); Console.WriteLine(rect1.Bottom); Console.WriteLine(rect1.Center); Console.WriteLine(rect1.DownLeft); Console.WriteLine(rect1.DownRight); Console.WriteLine(rect1.Height); Console.WriteLine(rect1.Width); Console.WriteLine(rect1.Left); Console.WriteLine(rect1.Right); Console.WriteLine(rect1.Top); Console.WriteLine(rect1.UpLeft); Console.WriteLine(rect1.UpRight); Console.WriteLine(rect2.ToString()); Console.WriteLine(rect2.GetPerimeter()); Console.WriteLine(rect2.GetArea()); Console.WriteLine(rect2.Bottom); Console.WriteLine(rect2.Center); Console.WriteLine(rect2.DownLeft); Console.WriteLine(rect2.DownRight); Console.WriteLine(rect2.Height); Console.WriteLine(rect2.Width); Console.WriteLine(rect2.Left); Console.WriteLine(rect2.Right); Console.WriteLine(rect2.Top); Console.WriteLine(rect2.UpLeft); Console.WriteLine(rect2.UpRight); Console.WriteLine(rect1.Equals(rect2)); }