Question: done in java please import java.util.UUID; public class Point { private int x; private int y; private UUID uniqueId; public Point() { } public Point(int
done in java please
import java.util.UUID;
public class Point
{
private int x;
private int y;
private UUID uniqueId;
public Point()
{
}
public Point(int x, int y)
{
this.x = x;
this.y = y;
this.uniqueId = UUID.randomUUID();
}
public int getX()
{
return x;
}
public void setX(int x)
{
this.x = x;
}
public int getY()
{
return y;
}
public void setY(int y)
{
this.y = y;
}
public UUID getUniqueId()
{
return uniqueId;
}
@Override
public String toString()
{
return String.format("(%d, %d)", this.x, this.y);
}
public double Distance(Point p)
{
// distance = square root of ( (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2) )
return Math.sqrt(Math.pow((this.x - p.x), 2) + Math.pow((this.y - p.y), 2));
}
public String ToCircle(Point p, double radius)
{
double rSqr = Math.pow(radius, 2);
// distance * distance
// distance * distance > radius * radius, then point is outside
return Distance(p)
}
}
Step 2 Define a class called Point_Client and satisfy the following requirements: 1. Declare 3 Point Objects. Pointi [Non-Parameter); Point2 x = 1, y = 1; Point3 x = 3, y=4. 2. Print the basic information of the defined objects on console. 3. Check the distance from Point1 to Point2 and Point3. 4. Check the position of Point2 and Point3 to a circle whose center is Pointi and the radius is 2. 5. Check the position of Point2 and Point3 to a circle whose center is Point and the radius is 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
