Question: 38) Consider the following classes: public abstract class PointXY private int x, y public PointXY (int x, int y this.x-x: this.y-y pubiic int getX0return x:
38) Consider the following classes: public abstract class PointXY private int x, y public PointXY (int x, int y this.x-x: this.y-y pubiic int getX0return x: public int getY0 return y pubiic string tostring) return "getx getY) publie abstract Poinn moveBy (int da, int dy); publie abstract double distance From(PointXY p) public abstract class CartesianPoint extends PointXY ( public cCartesianPoint (int x, int y) ty public double distanceFrom(PointXY p)Code not shown> public class BoardPosition extends CartesianPoint f Code not shown Which of the following is the minimal set of public constructors and/or methods required n the BoardPosition class, so that the statements? oardPosition pos -new BoardPosition(o, 0) ystem.out.printin (pos.moveBy (10, 10).distanceFrom (pos)): mpile with no errors? public PointXY moveBy(int dx, int dy public BoardPosition int x, int y) and public PointXY moveBy(int dx, int dy) public double distanceF rom(PointXY posjand public PointXY moveBy(int dx, int dy) public double distanceFrom(BoardPosition pos)and public BoardPosition moveBy(in dx, int dy) public BoardPosition)and public BoardPosition int x, int y)and public PointXY noveBy(int dx, int dy)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
