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 Emont.
All Emonts share a single IL_NION, which is a string. It is a constant. Its value is "ies". Other classes can see its value.
All Emonts share a single sce, which is a string. No other classes can directly ask for the value of sce. The value of sce starts out as "intras" when the program starts. Every time a new Emont is created, it adds "adcash" to sce.
Each Emont has a cel, which is a list of strings. A cel is part of the internal state of an Emont: no other classes can see the value of cel or directly change it. When an Emont is first created, the value of its cel starts out as an empty mutable list.
Each Emont has its own tesji, which is an int. The value of tesji is specified when a Emont is created. Anyone can ask an Emont for the value of its tesji. The value of tesji for a specific Emont can never change.
Each Emont has its own uli, which is a list of strings. The value of uli starts out as an empty mutable list. Anyone can ask an Emont for the value of its uli. Anyone can set uli to a new value.
Each Emont has its own lic, which is a list of strings. The value of lic starts out as an empty mutable list. Anyone can ask an Emont for the value of its lic. Anyone can set lic to a new value.
Each Emont has its own iada, which is an int. The value of iada is specified when a Emont is created. Anyone can ask an Emont for the value of its iada. The value of iada for a specific Emont can never change.
All Emonts share a single gri, which is a list of strings. No other classes can directly ask for the value of gri. The value of gri starts out as an empty mutable list when the program starts. Every time a new Emont is created, it adds "biss" to gri.
An Emont can boxilate. This behavior adds "bidrid" to cel. Anyone can ask an Emont to boxilate.
Each Emont has a siad, which is an int. The value of siad is not part of an Emont’s internal state; instead, it is computed on demand. The computed value of siad is the length of IL_NION.
Each Emont has a eiCeue, which is a string. The value of eiCeue is not part of an Emont’s internal state; instead, it is computed on demand. The computed value of eiCeue is the first element of uli.
An Emont can annuetate. This behavior adds "ciong" to lic. Anyone can ask an Emont to annuetate.
Each Emont has a nibec, which is an int. The value of nibec is not part of an Emont’s internal state; instead, it is computed on demand. The computed value of nibec is the size of lic.
An Emont can trisate. This behavior adds "trar" to sce. Anyone can ask an Emont to trisate.
Each Emont has a xapon, which is a string. The value of xapon is not part of an Emont’s internal state; instead, it is computed on demand. The computed value of xapon is sce with two exclamation points appended.
public class Emont {
private static String IL_NION = "ies";
public static String sce;
public static List<String> gri;
public List<String> cel = new ArrayList<>();
private int tesji;
private final List<String> uli;
private final List<String> lic;
private int iada;
private int siad;
private String eiCeue;
private int nibec;
private String xapon;
public Emont(int tesji, int iada) {
sce += "adcash";
this.tesji = tesji;
this.iada = iada;
gri.add("biss");
}
public static void onStart() {
sce = "intras";
gri = new ArrayList<>();
}
public int getTesji() {
return tesji;
}
public void setTesji(int tesji) {
this.tesji = tesji;
}
public List<String> getUli() {
return uli;
}
public List<String> getLic() {
return lic;
}
public int getIada() {
return iada;
}
public void setIada(int iada) {
this.iada = iada;
}
private void setBoxilate() {
cel.add("bidrid");
}
public int getSiad() {
return IL_NION.length();
}
public void setSiad(int siad) {
this.siad = siad;
}
public String getEiCeue() {
return uli.get(0);
}
public void setEiCeue(String eiCeue) {
this.eiCeue = eiCeue;
}
private void setAnnuetate() {
lic.add("ciong");
}
public int getNibec() {
return lic.size();
}
public void setNibec(int nibec) {
this.nibec = nibec;
}
private void setTrisate() {
sce += "trar";
}
public String getXapon() {
return sce + "!!";
}
public void setXapon(String xapon) {
this.xapon = xapon;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: