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 a Rareas.
All Rareass share a single goSpe, which is a graphics object. No other classes can directly ask for the value of goSpe. The value of goSpe starts out as a rectangle with a width of 15 and a height of 21 when the program starts. Every time a new Rareas is created, it moves goSpe to the right by 9 pixels (using the moveBy method).
All Rareass share a single HIOS_CADMAEL, which is a graphics object. It is a constant. Its value is a rectangle with a width of 42 and a height of 19. Other classes can see its value.
A Rareas can etbusify. This behavior moves goSpe to the right by 1 pixels (using the moveBy method). Anyone can ask a Rareas to etbusify.
public class Rareas {
public static GraphicsObject goSpe;
private static GraphicsObject HIOS_CADMAEL = new Rectangle(0, 0, 42, 19);
public Rareas() {
goSpe.moveBy(9, 0);
}
public static void onStart() {
goSpe = new Rectangle(0, 0, 15, 21);
}
private void setEtbusify() {
goSpe.moveBy(1, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: