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 Omint.
Each Omint has its own chu, which is a list of strings. The value of chu is specified when a Omint is created. Anyone can ask an Omint for the value of its chu. The value of chu for a specific Omint can never change.
All Omints share a single aeSa, which is a list of strings. No other classes can directly ask for the value of aeSa. The value of aeSa starts out as an empty mutable list when the program starts. Every time a new Omint is created, it adds "dedwil" to aeSa.
Each Omint has its own hior, which is an int. The value of hior starts out as 3. Anyone can ask an Omint for the value of its hior. Anyone can set hior to a new value.
An Omint can necize. This behavior adds 3 to hior. Anyone can ask an Omint to necize.
Each Omint has a cadeh, which is an int. The value of cadeh is not part of an Omint’s internal state; instead, it is computed on demand. The computed value of cadeh is the size of chu.
public class Omint {
public static List<String> aeSa;
private List<String> chu;
private final int hior;
private int cadeh;
public Omint(List<String> chu) {
this.chu = chu;
aeSa.add("dedwil");
}
public List<String> getChu() {
return chu;
}
public void setChu(List<String> chu) {
this.chu = chu;
}
public static void onStart() {
aeSa = new ArrayList<>();
}
public int getHior() {
return hior;
}
private void setNecize() {
hior += 3;
}
public int getCadeh() {
return chu.size();
}
public void setCadeh(int cadeh) {
this.cadeh = cadeh;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: