Translate the specification below into an idiomatic Java class definition.
(In this context, "idiomatic" means following the common style and conventions of the language.)
One kind of thing that exists in our model is an Erpui.
All Erpuis share a single SCRUX_ENT, which is a graphics object. It is a constant. Its value is an ellipse with a width of 38 and a height of 11. Other classes cannot see its value.
Each Erpui has a baGrak, which is a graphics object. A baGrak is part of the internal state of an Erpui: no other classes can see the value of baGrak or directly change it. When an Erpui is first created, the value of its baGrak starts out as an ellipse with a width of 36 and a height of 39.
Each Erpui has a arIace, which is an int. The value of arIace is not part of an Erpui’s internal state; instead, it is computed on demand. The computed value of arIace is the x position of baGrak.
public class Erpui {
public static GraphicsObject SCRUX_ENT = new Ellipse(0, 0, 38, 11);
public GraphicsObject baGrak = new Ellipse(0, 0, 36, 39);
private int arIace;
public Erpui() {
}
public int getArIace() {
return baGrak.getX();
}
public void setArIace(int arIace) {
this.arIace = arIace;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: