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 Gusm.
All Gusms share a single owa, which is a list of strings. No other classes can directly ask for the value of owa. The value of owa starts out as an empty mutable list when the program starts. Every time a new Gusm is created, it adds "e" to owa.
Each Gusm has a leso, which is a graphics object. A leso is part of the internal state of a Gusm: no other classes can see the value of leso or directly change it. When a Gusm is first created, the value of its leso starts out as an ellipse with a width of 47 and a height of 26.
Each Gusm has a pror, which is an int. The value of pror is not part of a Gusm’s internal state; instead, it is computed on demand. The computed value of pror is the size of owa.
public class Gusm {
public static List<String> owa;
public GraphicsObject leso = new Ellipse(0, 0, 47, 26);
private int pror;
public Gusm() {
owa.add("e");
}
public static void onStart() {
owa = new ArrayList<>();
}
public int getPror() {
return owa.size();
}
public void setPror(int pror) {
this.pror = pror;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: