Using Python 3:
Create a point p1 of coordinates (0; 0) and un point p2 of
coordinates (1; 2). Print out the coordinates of
the two points on the same line, by calling toString on the two
points. Print the
result of applying the method equals on point p1, using p2 as
argument. Set the x
coordinate of p2 equal to the x coordinate of p1, using the methods
setX and getX.
Set the y coordinate of p2 equal to the y coordinate of p1, using
the method setY
and getY. Print again the result of applying the method equals on
point p1, using
p2 as argument. Increment by 1 the x coordinate of p2, using the
methods setX and
getX . Print again the result of applying the method equals on
point p1, using p2
as argument.
class Point:
def __init__(self,x,y):
if(not isinstance(x,int) or not isinstance(y,int)):
raise ValueError("Invalid coordinate")
self.x = x
self.y = y
def getX(self):
return self.x
def getY(self):
return self.y
def setX(self, X):
self.x = X
def setY(self, Y):
self.y = Y
def Print(self):
print(self.x,self.y)
def main():
try:
q = Point(3, 4)
q.Print()
q.setX(5)
q.setY(7)
q.Print()
except ValueError as ex:
print(ex)
main()


Using Python 3: Create a point p1 of coordinates (0; 0) and un point p2 of...
Java Help 2. Task: Create a client for the Point class. Be very thorough with your testing (including invalid input) and have output similar to the sample output below: ---After declaration, constructors invoked--- Using toString(): First point is (0, 0) Second point is (7, 13) Third point is (7, 15) Second point (7, 13) lines up vertically with third point (7, 15) Second point (7, 13) doesn't line up horizontally with third point (7, 15) Enter the x-coordinate for first...
In JAVA Design a class named Point that meets the following requirements: Two data fields x and y for representing a point with getter methods. A no-arg constructor that constructs a point for (0, 0). A constructor that constructs a point with the specified x and y values. Override the equals method. Point p1 is said to be greater than point p2 if p1.x == p2.x and p1.y == p2.y. Implement the Comparable<Point> interface and the compareTo method. Point p1...
In Java please!
Problem You will be using the point class discussed in class to create a Rectangle class. You also need to have a driver class that tests your rectangle. Requirements You must implement the 3 classes in the class diagram below and use the same naming and data types. Following is a description of what each method does. Point Rectangle RectangleDriver - x: int - top Left: Point + main(args: String[) - y: int - width: int +...
Create a MyPoint class to model a point in a two-dimensional space. The MyPoint class contains: • Two data fields x and y that represent the coordinates. • A no-arg constructor that creates a point (0,0). • A constructor that constructs a point with specified coordinates. • Two get functions for data fields x and y, respectively. • Two set functions for data fields x and y, respectively. • A function named distance that returns the distance from this point...
Implement the Point class (code for this up to the isHigher
method was discussed in the
lecture). The class has the following instance variables:
• x coordinate (an int)
• y coordinate (an int)
and the following methods:
• Constructor that sets the x and y coordinates
• Get and set methods
• Method equals if this point is equal to another point object
(if the x and y coordinates are the
same).
• Method isHigher if this point is...
Can I get some help with this problem? Can someone show how do this in C? Thank you for your help. Write a C object-oriented program that reads the coordinates of two points in the plane and shows the distance between them. In order to do that implement the class Point. Point{ float x; float y; Point(): void set (float x, float y): void getX( ): float (optional implementation) getY( ): float (optional...
Must be in Java.
Show proper reasoning with step by step
process.
Comment on the code please and show proper
indentation.
Use simplicity.
Must match the exact Output.
CODE GIVEN:
LineSegment.java
LineSegmentTest.java
Point.java
public class Point {
private double x, y; // x and y coordinates of
point
/**
* Creates an instance of Point with the provided coordinates
* @param inX the x coordinate
* @param inY the y coordinate
*/
public Point (double inX, double inY) {
this.x...
Complete the following coding in java
Create a class Circle that represents a round moving dot. A circle object needs to contain double variables to store the: Current X location of the circle's center Current Y location of the circle's center Radius of the circle Direction of the circle's movement in radians Speed of the circle's movement . . The Circle class must contain a constructor Circle double x, double y, double radius) that initializes the circles center x, y...
NEEDS TO BE IN PYTHON: (The Point class) Design a class named Point to represent a point with x- and y-coordinates. The class contains: - Two private data fields x and y that represent the coordinates with get methods. - A constructor that constructs a point with specified coordinates, with default point (0, 0). - A method named distance that returns the distance from this point to another point of the Point type. - A method named isNearBy(p1) that returns...
using python 3: Do not change the tests. Write the body of the distFromOrigin method. class Point: def __init__(self, initX, initY): """ Create a new point at the given coordinates """ self.__x = initX self.__y = initY def getX(self): """ Get its x coordinate """ return self.__x def getY(self): """ Get its y coordinate """ return self.__y def __str__(self): """ Return a string representation of self """ return "({}, {})".format(self.__x, self.__y) def distFromOrigin(self): """ Return the distance between self and...