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 Hoicel.
Each Hoicel has a volum, which is a list of strings. A volum is part of the internal state of a Hoicel: no other classes can see the value of volum or directly change it. When a Hoicel is first created, the value of its volum starts out as an empty mutable list.
All Hoicels share a single OILDI_DI, which is an int. It is a constant. Its value is 12. Other classes cannot see its value.
All Hoicels share a single ilCe, which is a list of strings. No other classes can directly ask for the value of ilCe. The value of ilCe starts out as an empty mutable list when the program starts. Every time a new Hoicel is created, it adds "rosmand" to ilCe.
A Hoicel can phrorate. This behavior adds "rhoer" to ilCe. Anyone can ask a Hoicel to phrorate.
Each Hoicel has a seBe, which is an int. The value of seBe is not part of a Hoicel’s internal state; instead, it is computed on demand. The computed value of seBe is the size of ilCe.
public class Hoicel {
public static List<String> ilCe;
public List<String> volum = new ArrayList<>();
public final int OILDI_DI = 12;
private int seBe;
public Hoicel() {
ilCe.add("rosmand");
}
public static void onStart() {
ilCe = new ArrayList<>();
}
private void setPhrorate() {
ilCe.add("rhoer");
}
public int getSeBe() {
return ilCe.size();
}
public void setSeBe(int seBe) {
this.seBe = seBe;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: