Your team has been tasked with designing a simple Circle class. After some back and forth, you agree that Circle objects should be able to do the following:
You may assume the existence of the Point class below as you work on your Circle class definition.
public class Point {
private int x;
private int y;
public Point (int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public void shift(int xChange, int yChange) {
x += xChange;
y += yChange;
}
public Point shiftedBy(int xChange, int yChange) {
return new Point(x + xChange, y + yChange);
}
public int squaredDistanceFrom(Point p) {
int deltax = x - p.x;
int deltay = y - p.y;
return deltax * deltax + deltay * deltay;
}
}
As a team, discuss and come to a consensus on your answers to the questions below.
shift and shiftedBy of the Point class?Circle class need to have? The are fundamentally two choices here, discuss the differences between them.Circle object?Circle functionality given above describe accessors?Circle class functionality. Once you are done, compare your method signatures with those of another team. Is there disagreement on any of the following?
Circle class method.Circle class method. When you are done discuss the following:
Circle constructor can be implemented in two ways:
Point object for its center, orPoint object of its own based on the provided Point object.shift or shiftedBy methods, how would it have to change if one of those methods did not exist?shift and rescale methods for the Circle class are changed so that they return a new Circle object.
Circle class be changed to final?