Answered step by step
Verified Expert Solution
Question
1 Approved Answer
File 1 : / * * This class represents points in the plane. * / public class Point { private double x; private double y;
File :
This class represents points in the plane.
public class Point
private double x;
private double y;
public Point default constructor
this.x ;
this.y ;
Create a Point object with the given coordinates.
@param x xcoordinate value for the new Point object
@param y ycoordinate value for the new Point object
public Pointdouble x double y
implementation
Change this Point object to have the given xcoordinate.
@param newX new xcoordinate for this Point object
public void setXdouble newX
implementation
Get the x coordinate of this Point object.
@return this Point's xcoordinate
public double getX
implementation
Change this Point object to have the given ycoordinate.
@param newY new ycoordinate for this Point object
public void setYdouble newY
implementation
Get the ycoordinate of this Point object.
@return this Point's ycoordinate
public double getY
implementation
Determine if this Point object has the same xcoordinate
and the same ycoordinate as the given Point.
@param p a reference to a second Point object
@return true if the given Point is equal to this Point
public boolean equalsPoint p
implementation
Determine which quadrant of the plane this Point is in
Quadrant has positive x and y coordinates.
Quadrant has negative x coordinates and positice y coordinates.
Quadrant has negative x and y coordinates.
Quadrant has positive x coordinates and negative y coordinates.
Note: The positive x and y axes are in quadranr
The negative x axis is in quarant
The negative y axis is in quadrant
@return the quadrant number of this Point object
public int quadrant
implementation
public String toString
return "Point: x y ;
File :
This class represents circles in the plane.
public public class Circle
private double radius;
private Point center;
public Circle default constructor
this.radius ;
this.center new Point;
public Circledouble r
this.radius r;
this.center new Point;
Create a Circle object with the given radius and center Point.
@param r radius for the new Circle object
@param c center Point for the new Circle object
public Circledouble r Point c
implementation
Change this Circle's center point to be the given point.
@param center new center Point for the this Circle object
public void setCenterPoint center
implementation
public Point getCenter
return this.center;
public void setRadiusdouble r
this.radius r;
public double getRadius
return this.radius;
Translate the center of this circle by the given
amounts in the x and y directions.
@param dx how much to move the center of this Circle in the xdirection
@param dy how much to move the center of this Circle in the ydirection
public void translateBydouble dx double dy
implementation
Translate the center of this circle to the given
amounts in the x and y directions.
@param x new xcoordinate for the center of this Circle
@param y new ycoordinate for the center of this Circle
public void translateTodouble x double y
implementation
public String toString
return "Circle: r radius center center.getX center.getY;
File ReadOnly
import java.util.Scanner;
public class Tester
public static void mainString args
Scanner in new ScannerSystemin;
int testCase innextInt;
if testCase
Point p new Point;
psetX;
psetY;
System.out.println p;
Point p new Point;
psetX;
psetY;
System.out.println p;
System.out.println pquadrant;
System.out.println pquadrant;
System.out.println pequalsp;
else if testCase
Circle c new Circle;
Point p new Point;
psetX;
psetY;
csetRadius;
csetCenterp;
System.out.println c ;
ctranslateBy;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started