Question: Add the following methods to the Point class: public String toString ( ) Make it return a string in the following format : [ x
Add the following methods to the Point class:
public String toString
Make it return a string in the following format : x y For example, if a Point object stored in a variable pt represents the point return the string: xy
public boolean isQuadrant
Returns true if this Point object is located in Quadrant of the xy plane. Quadrant contains all points whose x and y values are both positive. Returns false otherwise. If the point lies directly on the x andor y axis return false.
public void swap
Negates and swaps the xy coordinates of the Point object. For example, if the object initially represents the point after a call to flip, the object should represent If the object initially represents the point after a call to swap, the object should present
Please note that swapping values takes three steps : For example, to swap x and y xy and yx will store same contents. Instead,
int temp x; store old x value to temp
x y; update x with y
y temp; update y with old x
public boolean equalsPoint other
Returns true if the object to be compared has same x and y coordinates. false otherwise.
public Point Point p
Write a rd constructor that constructs and initializes a point with the same location as the specified Point object.
public Point makeCopy
Creates a new Point object with the same contents as this Point object. The method should then return the new Point object you created. Please note that you can create a new Point object using
Point p new Point or Point p new Point x y
Your code is being added to the Point class we wrote in class. Demonstrate all of the above methods in PointClient.java by calling them appropriately. Submit Point.java and PointClient.java on Canvas.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
