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 Tani.
All Tanis share a single eci, which is a list of strings. No other classes can directly ask for the value of eci. The value of eci starts out as an empty mutable list when the program starts. Every time a new Tani is created, it adds "nir" to eci.
All Tanis share a single ONTH_IO, which is a string. It is a constant. Its value is "cillarm". Other classes can see its value.
Each Tani has its own ossso, which is a graphics object. The value of ossso starts out as an ellipse with a width of 37 and a height of 31. Anyone can ask a Tani for the value of its ossso. Anyone can set ossso to a new value.
A Tani can roirate. This behavior moves ossso to the right by 1 pixels (using the moveBy method). Anyone can ask a Tani to roirate.
Each Tani has a leMalho, which is an int. The value of leMalho is not part of a Tani’s internal state; instead, it is computed on demand. The computed value of leMalho is the width of ossso.
public class Tani {
public static List<String> eci;
private static String ONTH_IO = "cillarm";
private final GraphicsObject ossso;
private int leMalho;
public Tani() {
eci.add("nir");
}
public static void onStart() {
eci = new ArrayList<>();
}
public GraphicsObject getOssso() {
return ossso;
}
private void setRoirate() {
ossso.moveBy(1, 0);
}
public int getLeMalho() {
return ossso.getWidth();
}
public void setLeMalho(int leMalho) {
this.leMalho = leMalho;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: