public class Point private int x; private int y; public void setx(int x) this.xX
ID: 3745876 • Letter: P
Question
public class Point private int x; private int y; public void setx(int x) this.xX public void set(int y) this.y-y; public void setXY(int x, int y) X-y: public boolean IsEqual(Point p) return ((p.xx) & (p.y - y)) public void DisplayPoint) System.out.printin+y")") public void novePoint(int deltax, int deltay) xis increased by deltax and y is increased by deltay public void Setlocation(Point P) (imake point to have the specified location P public static void nain(Stringt) args) ( TOO Auto-generated nethod stub Point P1- new Point; Point P2- new Point) P1.setx(5); P1.sety(6); P2.setx(5); P2.sety(6); System.out.printin(P1.IsEqual (P2)) P2.setXY(3,4); Systen.out.printin(P1.IsEqual(P2)) Given the class'Point which has two member variables x, and y. What are x and y for Point objec P1 after the end of the main method?Explanation / Answer
class point
{
private int x;
private int y;
public void setx(int x)
{
this.x = x;
}
public void sety(int y)
{
this.y = y;
}
public void setxy(int x, int y)
{
x = y;
y = y;
}
public static void main(String[] args) {
point p1 = new point();
point p2 = new point();
p1.setx(5);
p1.sety(6);
p2.setx(5);
p2.sety(6);
System.out.println(p1.equals(p2));
p2.setxy(3,4);
System.out.println(p1.equals(p2));
// what are x and y for point object p1 ? lests check
System.out.println(p1.x); // print 5
System.out.println(p1.y); // print 6
}
}
Thank you. i hope you got it what you wanted.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.