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 HioFleco.
All HioFlecos share a single OSSACS, which is a graphics object. It is a constant. Its value is an ellipse with a width of 27 and a height of 10. Other classes cannot see its value.
All HioFlecos share a single siIor, which is a graphics object. No other classes can directly ask for the value of siIor. The value of siIor starts out as an ellipse with a width of 18 and a height of 11 when the program starts. Every time a new HioFleco is created, it moves siIor to the right by 6 pixels (using the moveBy method).
A HioFleco can sevilify. This behavior moves siIor to the right by 6 pixels (using the moveBy method). Anyone can ask a HioFleco to sevilify.
public class HioFleco {
public static GraphicsObject OSSACS = new Ellipse(0, 0, 27, 10);
public static GraphicsObject siIor;
public HioFleco() {
siIor.moveBy(6, 0);
}
public static void onStart() {
siIor = new Ellipse(0, 0, 18, 11);
}
private void setSevilify() {
siIor.moveBy(6, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: