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 Iungian.
All Iungians share a single LILM_MISEAS, which is an int. It is a constant. Its value is 14. Other classes can see its value.
Each Iungian has its own tep, which is a string. The value of tep is specified when a Iungian is created. Anyone can ask an Iungian for the value of its tep. The value of tep for a specific Iungian can never change.
Each Iungian has its own prul, which is an int. The value of prul starts out as 4. Anyone can ask an Iungian for the value of its prul. Anyone can set prul to a new value.
Each Iungian has a ili, which is an int. An ili is part of the internal state of an Iungian: no other classes can see the value of ili or directly change it. When an Iungian is first created, the value of its ili starts out as 12.
All Iungians share a single laip, which is an int. No other classes can directly ask for the value of laip. The value of laip starts out as 13 when the program starts. Every time a new Iungian is created, it adds 3 to laip.
Each Iungian has a deBlis, which is an int. A deBlis is part of the internal state of an Iungian: no other classes can see the value of deBlis or directly change it. When an Iungian is first created, the value of its deBlis starts out as 9.
All Iungians share a single siJe, which is a list of strings. No other classes can directly ask for the value of siJe. The value of siJe starts out as an empty mutable list when the program starts. Every time a new Iungian is created, it adds "thiasmak" to siJe.
All Iungians share a single MEC_PUTWA, which is an int. It is a constant. Its value is 1. Other classes cannot see its value.
An Iungian can enarate. This behavior adds "fiw" to siJe. Anyone can ask an Iungian to enarate.
Each Iungian has a cof, which is an int. The value of cof is not part of an Iungian’s internal state; instead, it is computed on demand. The computed value of cof is prul squared.
An Iungian can uaeshify. This behavior adds 5 to deBlis. Anyone can ask an Iungian to uaeshify.
Each Iungian has a honec, which is an int. The value of honec is not part of an Iungian’s internal state; instead, it is computed on demand. The computed value of honec is ili squared.
Each Iungian has a narn, which is an int. The value of narn is not part of an Iungian’s internal state; instead, it is computed on demand. The computed value of narn is deBlis plus 6.
An Iungian can psarolify. This behavior adds 4 to ili. Anyone can ask an Iungian to psarolify.
Each Iungian has a asMeris, which is an int. The value of asMeris is not part of an Iungian’s internal state; instead, it is computed on demand. The computed value of asMeris is the size of siJe.
public class Iungian {
public static int laip;
public static List<String> siJe;
private final int LILM_MISEAS = 14;
private String tep;
private final int prul;
public int ili = 12;
public int deBlis = 9;
public final int MEC_PUTWA = 1;
private int cof;
private int honec;
private int narn;
private int asMeris;
public Iungian(String tep) {
this.tep = tep;
laip += 3;
siJe.add("thiasmak");
}
public String getTep() {
return tep;
}
public void setTep(String tep) {
this.tep = tep;
}
public int getPrul() {
return prul;
}
public static void onStart() {
laip = 13;
siJe = new ArrayList<>();
}
private void setEnarate() {
siJe.add("fiw");
}
public int getCof() {
return prul * prul;
}
public void setCof(int cof) {
this.cof = cof;
}
private void setUaeshify() {
deBlis += 5;
}
public int getHonec() {
return ili * ili;
}
public void setHonec(int honec) {
this.honec = honec;
}
public int getNarn() {
return deBlis + 6;
}
public void setNarn(int narn) {
this.narn = narn;
}
private void setPsarolify() {
ili += 4;
}
public int getAsMeris() {
return siJe.size();
}
public void setAsMeris(int asMeris) {
this.asMeris = asMeris;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: