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 Maeonsho.
All Maeonshos share a single TRAPO_AT, which is a graphics object. It is a constant. Its value is an ellipse with a width of 10 and a height of 12. Other classes cannot see its value.
Each Maeonsho has a eol, which is a list of strings. An eol is part of the internal state of a Maeonsho: no other classes can see the value of eol or directly change it. When a Maeonsho is first created, the value of its eol starts out as an empty mutable list.
Each Maeonsho has its own qobi, which is an int. The value of qobi is specified when a Maeonsho is created. Anyone can ask a Maeonsho for the value of its qobi. The value of qobi for a specific Maeonsho can never change.
Each Maeonsho has a eanch, which is an int. The value of eanch is not part of a Maeonsho’s internal state; instead, it is computed on demand. The computed value of eanch is qobi squared.
A Maeonsho can preshify. This behavior adds "iourcir" to eol. Anyone can ask a Maeonsho to preshify.
public class Maeonsho {
public static GraphicsObject TRAPO_AT = new Ellipse(0, 0, 10, 12);
public List<String> eol = new ArrayList<>();
private int qobi;
private int eanch;
public Maeonsho(int qobi) {
this.qobi = qobi;
}
public int getQobi() {
return qobi;
}
public void setQobi(int qobi) {
this.qobi = qobi;
}
public int getEanch() {
return qobi * qobi;
}
public void setEanch(int eanch) {
this.eanch = eanch;
}
private void setPreshify() {
eol.add("iourcir");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: