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 Eospi.
Each Eospi has its own mep, which is a graphics object. The value of mep is specified when a Eospi is created. Anyone can ask an Eospi for the value of its mep. Anyone can set mep to a new value.
All Eospis share a single HE_TERDSWAD, which is a graphics object. It is a constant. Its value is a rectangle with a width of 19 and a height of 29. Other classes can see its value.
Each Eospi has its own keoir, which is an int. The value of keoir is specified when a Eospi is created. Anyone can ask an Eospi for the value of its keoir. The value of keoir for a specific Eospi can never change.
Each Eospi has a ajull, which is a graphics object. An ajull is part of the internal state of an Eospi: no other classes can see the value of ajull or directly change it. When an Eospi is first created, the value of its ajull starts out as a rectangle with a width of 17 and a height of 11.
All Eospis share a single ciric, which is an int. No other classes can directly ask for the value of ciric. The value of ciric starts out as 18 when the program starts. Every time a new Eospi is created, it adds 2 to ciric.
An Eospi can bicate. This behavior adds 8 to ciric. Anyone can ask an Eospi to bicate.
Each Eospi has a moBe, which is an int. The value of moBe is not part of an Eospi’s internal state; instead, it is computed on demand. The computed value of moBe is ciric squared.
An Eospi can rionify. This behavior moves mep to the right by 1 pixels (using the moveBy method). Anyone can ask an Eospi to rionify.
Each Eospi has a ider, which is an int. The value of ider is not part of an Eospi’s internal state; instead, it is computed on demand. The computed value of ider is ciric squared.
public class Eospi {
private static GraphicsObject HE_TERDSWAD = new Rectangle(0, 0, 19, 29);
public static int ciric;
private final GraphicsObject mep;
private int keoir;
public GraphicsObject ajull = new Rectangle(0, 0, 17, 11);
private int moBe;
private int ider;
public Eospi(GraphicsObject mep, int keoir) {
this.mep = mep;
this.keoir = keoir;
ciric += 2;
}
public GraphicsObject getMep() {
return mep;
}
public int getKeoir() {
return keoir;
}
public void setKeoir(int keoir) {
this.keoir = keoir;
}
public static void onStart() {
ciric = 18;
}
private void setBicate() {
ciric += 8;
}
public int getMoBe() {
return ciric * ciric;
}
public void setMoBe(int moBe) {
this.moBe = moBe;
}
private void setRionify() {
mep.moveBy(1, 0);
}
public int getIder() {
return ciric * ciric;
}
public void setIder(int ider) {
this.ider = ider;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: