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 Enoud.
All Enouds share a single okil, which is an int. No other classes can directly ask for the value of okil. The value of okil starts out as 6 when the program starts. Every time a new Enoud is created, it adds 1 to okil.
Each Enoud has its own deResm, which is a string. The value of deResm starts out as "i". Anyone can ask an Enoud for the value of its deResm. Anyone can set deResm to a new value.
All Enouds share a single CORMLE, which is a graphics object. It is a constant. Its value is a rectangle with a width of 42 and a height of 20. Other classes cannot see its value.
Each Enoud has a taPhe, which is an int. The value of taPhe is not part of an Enoud’s internal state; instead, it is computed on demand. The computed value of taPhe is okil squared.
An Enoud can hecesate. This behavior adds 7 to okil. Anyone can ask an Enoud to hecesate.
public class Enoud {
public static int okil;
public static GraphicsObject CORMLE = new Rectangle(0, 0, 42, 20);
private final String deResm;
private int taPhe;
public Enoud() {
okil += 1;
}
public static void onStart() {
okil = 6;
}
public String getDeResm() {
return deResm;
}
public int getTaPhe() {
return okil * okil;
}
public void setTaPhe(int taPhe) {
this.taPhe = taPhe;
}
private void setHecesate() {
okil += 7;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: