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 Sadish.
All Sadishs share a single MENGMENG, which is a graphics object. It is a constant. Its value is an ellipse with a width of 38 and a height of 37. Other classes can see its value.
All Sadishs share a single hosba, which is a string. No other classes can directly ask for the value of hosba. The value of hosba starts out as "stente" when the program starts. Every time a new Sadish is created, it adds "buec" to hosba.
Each Sadish has its own glurs, which is a string. The value of glurs starts out as "su". Anyone can ask a Sadish for the value of its glurs. Anyone can set glurs to a new value.
Each Sadish has a cof, which is an int. The value of cof is not part of a Sadish’s internal state; instead, it is computed on demand. The computed value of cof is the width of MENGMENG.
A Sadish can spetate. This behavior adds "aeeng" to hosba. Anyone can ask a Sadish to spetate.
public class Sadish {
private static GraphicsObject MENGMENG = new Ellipse(0, 0, 38, 37);
public static String hosba;
private final String glurs;
private int cof;
public Sadish() {
hosba += "buec";
}
public static void onStart() {
hosba = "stente";
}
public String getGlurs() {
return glurs;
}
public int getCof() {
return MENGMENG.getWidth();
}
public void setCof(int cof) {
this.cof = cof;
}
private void setSpetate() {
hosba += "aeeng";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: