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 Esschrin.
Each Esschrin has its own elEstor, which is a graphics object. The value of elEstor starts out as an ellipse with a width of 32 and a height of 24. Anyone can ask an Esschrin for the value of its elEstor. Anyone can set elEstor to a new value.
All Esschrins share a single SPANEC, which is an int. It is a constant. Its value is 11. Other classes cannot see its value.
Each Esschrin has a eoEsas, which is an int. The value of eoEsas is not part of an Esschrin’s internal state; instead, it is computed on demand. The computed value of eoEsas is SPANEC squared.
public class Esschrin {
private final GraphicsObject elEstor;
public final int SPANEC = 11;
private int eoEsas;
public Esschrin() {
}
public GraphicsObject getElEstor() {
return elEstor;
}
public int getEoEsas() {
return SPANEC * SPANEC;
}
public void setEoEsas(int eoEsas) {
this.eoEsas = eoEsas;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: