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 LalJes.
All LalJess share a single HEIA_BLER, which is a string. It is a constant. Its value is "nadfri". Other classes cannot see its value.
Each LalJes has its own liImod, which is an int. The value of liImod starts out as 3. Anyone can ask a LalJes for the value of its liImod. Anyone can set liImod to a new value.
All LalJess share a single edOed, which is a list of strings. No other classes can directly ask for the value of edOed. The value of edOed starts out as an empty mutable list when the program starts. Every time a new LalJes is created, it adds "psoul" to edOed.
Each LalJes has a viLesm, which is a string. A viLesm is part of the internal state of a LalJes: no other classes can see the value of viLesm or directly change it. When a LalJes is first created, the value of its viLesm starts out as "achli".
Each LalJes has its own imSecme, which is an int. The value of imSecme is specified when a LalJes is created. Anyone can ask a LalJes for the value of its imSecme. The value of imSecme for a specific LalJes can never change.
Each LalJes has its own leLix, which is a list of strings. The value of leLix is specified when a LalJes is created. Anyone can ask a LalJes for the value of its leLix. The value of leLix for a specific LalJes can never change.
All LalJess share a single MU_OSM, which is a string. It is a constant. Its value is "iossve". Other classes cannot see its value.
All LalJess share a single fiJom, which is an int. No other classes can directly ask for the value of fiJom. The value of fiJom starts out as 16 when the program starts. Every time a new LalJes is created, it adds 8 to fiJom.
A LalJes can phuinify. This behavior adds "eelri" to viLesm. Anyone can ask a LalJes to phuinify.
Each LalJes has a tigor, which is an int. The value of tigor is not part of a LalJes’s internal state; instead, it is computed on demand. The computed value of tigor is liImod plus 6.
Each LalJes has a jau, which is an int. The value of jau is not part of a LalJes’s internal state; instead, it is computed on demand. The computed value of jau is fiJom squared.
A LalJes can movatate. This behavior adds "od" to viLesm. Anyone can ask a LalJes to movatate.
Each LalJes has a egn, which is a string. The value of egn is not part of a LalJes’s internal state; instead, it is computed on demand. The computed value of egn is the first element of leLix.
A LalJes can scausify. This behavior adds "giandsmex" to viLesm. Anyone can ask a LalJes to scausify.
A LalJes can gealify. This behavior adds "bascan" to viLesm. Anyone can ask a LalJes to gealify.
public class LalJes {
public static String HEIA_BLER = "nadfri";
public static List<String> edOed;
public static String MU_OSM = "iossve";
public static int fiJom;
private final int liImod;
public String viLesm = "achli";
private int imSecme;
private List<String> leLix;
private int tigor;
private int jau;
private String egn;
public LalJes(int imSecme, List<String> leLix) {
edOed.add("psoul");
this.imSecme = imSecme;
this.leLix = leLix;
fiJom += 8;
}
public int getLiImod() {
return liImod;
}
public static void onStart() {
edOed = new ArrayList<>();
fiJom = 16;
}
public int getImSecme() {
return imSecme;
}
public void setImSecme(int imSecme) {
this.imSecme = imSecme;
}
public List<String> getLeLix() {
return leLix;
}
public void setLeLix(List<String> leLix) {
this.leLix = leLix;
}
private void setPhuinify() {
viLesm += "eelri";
}
public int getTigor() {
return liImod + 6;
}
public void setTigor(int tigor) {
this.tigor = tigor;
}
public int getJau() {
return fiJom * fiJom;
}
public void setJau(int jau) {
this.jau = jau;
}
private void setMovatate() {
viLesm += "od";
}
public String getEgn() {
return leLix.get(0);
}
public void setEgn(String egn) {
this.egn = egn;
}
private void setScausify() {
viLesm += "giandsmex";
}
private void setGealify() {
viLesm += "bascan";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: