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 Ites.
All Itess share a single ERTRARM, which is an int. It is a constant. Its value is 11. Other classes cannot see its value.
Each Ites has its own opiss, which is a graphics object. The value of opiss is specified when a Ites is created. Anyone can ask an Ites for the value of its opiss. The value of opiss for a specific Ites can never change.
All Itess share a single ooCunou, which is a string. No other classes can directly ask for the value of ooCunou. The value of ooCunou starts out as "me" when the program starts. Every time a new Ites is created, it adds "graftveass" to ooCunou.
Each Ites has a viik, which is an int. The value of viik is not part of an Ites’s internal state; instead, it is computed on demand. The computed value of viik is the width of opiss.
An Ites can pudelize. This behavior adds "floshen" to ooCunou. Anyone can ask an Ites to pudelize.
public class Ites {
public static String ooCunou;
public final int ERTRARM = 11;
private GraphicsObject opiss;
private int viik;
public Ites(GraphicsObject opiss) {
this.opiss = opiss;
ooCunou += "graftveass";
}
public GraphicsObject getOpiss() {
return opiss;
}
public void setOpiss(GraphicsObject opiss) {
this.opiss = opiss;
}
public static void onStart() {
ooCunou = "me";
}
public int getViik() {
return opiss.getWidth();
}
public void setViik(int viik) {
this.viik = viik;
}
private void setPudelize() {
ooCunou += "floshen";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: