Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The cartesian plane represents a two-dimensional space (in 2 dimensions), formed by two perpendicular lines, one horizontal and the other vertical, that intersect at a

The cartesian plane represents a two-dimensional space (in 2 dimensions), formed by two perpendicular lines, one horizontal and the other vertical, that intersect at a point. The horizontal line is called the abscissa axis or X axis, while the vertical line is called the ordinate axis or simply the Y axis. As for the point where they intersect, it is known as the point of origin O. It is important to note that the plane is divided into 4 quadrants.

points and coordinates

The representation of a point is simple: P(X,Y) where X and Y are the horizontal distance (left or right) and vertical distance (up or down) respectively, using the point of origin (0,0) as a reference, Right in the center of the plane.

Vectors in the plane

A vector in the plane refers to an oriented segment, generated from two distinct points. Given the relevant explanations, the following should be done:

• 1. Create the class called Point with its two coordinates X and Y.
• 2. Add a constructor method to easily create points. If a coordinate is not received, its value will be zero.
• 3. Overwrite the string method, so that when printing on the screen a point appears in (X,Y) format.
• 4. Add a method called quadrant that indicates which quadrant the point belongs to, taking into account that if X == 0 and Y != 0 it is located on the Y axis, if X != 0 and Y == 0 it is located about the X axis and if X == 0 and Y == 0 is about the origin.
• 5. Add a method called vector, which takes another point and calculates the resulting vector between the two points.
• 6. Add a method called distance, which takes another point and calculates the distance between the two points and displays it on the screen. The formula is as follows.
• 7. Create the class called Quadrilateral with two points (start and end) that will form the diagonal of the quadrilateral.
• 8. Add a constructor method to easily create both points, if they are not sent two points will be created at the origin by default.
• 9. Add to the quadrilateral a method called base that displays the base.
• 10. Add to the quadrilateral a method called height that displays the height.
• 11. Add to the quadrilateral a method called area that displays the area.
• 12. Add to the quadrilateral a method called isSquare that shows if it is a square or not.
• 13. Create the class called Triangle with 3 points (x, y, z) that will form the triangle.
• 14. Add a constructor method to create the points easily, if they are not sent, three points will be created at the origin by default.
• 15. Add to the triangle a method called area that displays the area.

Step by Step Solution

3.32 Rating (146 Votes )

There are 3 Steps involved in it

Step: 1

Python import math class Point def initself x0 y0 selfx x selfy y def strself return fselfxselfy def ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Accounting

Authors: Gail Fayerman

1st Canadian Edition

9781118774113, 1118774116, 111803791X, 978-1118037911

More Books

Students also viewed these Programming questions