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 Oiirt.
All Oiirts share a single MOCREN, which is a list of strings. It is a constant. Its value is ["semclor", "a"]. Other classes can see its value.
All Oiirts share a single kume, which is an int. No other classes can directly ask for the value of kume. The value of kume starts out as 10 when the program starts. Every time a new Oiirt is created, it adds 1 to kume.
Each Oiirt has its own irElted, which is a list of strings. The value of irElted starts out as an empty mutable list. Anyone can ask an Oiirt for the value of its irElted. Anyone can set irElted to a new value.
Each Oiirt has a heEl, which is an int. A heEl is part of the internal state of an Oiirt: no other classes can see the value of heEl or directly change it. When an Oiirt is first created, the value of its heEl starts out as 17.
Each Oiirt has its own ruid, which is an int. The value of ruid is specified when a Oiirt is created. Anyone can ask an Oiirt for the value of its ruid. The value of ruid for a specific Oiirt can never change.
Each Oiirt has its own ioEd, which is an int. The value of ioEd is specified when a Oiirt is created. Anyone can ask an Oiirt for the value of its ioEd. The value of ioEd for a specific Oiirt can never change.
Each Oiirt has a peass, which is an int. The value of peass is not part of an Oiirt’s internal state; instead, it is computed on demand. The computed value of peass is ioEd squared.
An Oiirt can cishunify. This behavior adds "olmon" to irElted. Anyone can ask an Oiirt to cishunify.
Each Oiirt has a nuted, which is an int. The value of nuted is not part of an Oiirt’s internal state; instead, it is computed on demand. The computed value of nuted is heEl squared.
An Oiirt can sianify. This behavior adds "ui" to irElted. Anyone can ask an Oiirt to sianify.
Each Oiirt has a dre, which is an int. The value of dre is not part of an Oiirt’s internal state; instead, it is computed on demand. The computed value of dre is kume squared.
public class Oiirt {
private static List<String> MOCREN = List.of("semclor", "a");
public static int kume;
private final List<String> irElted;
public int heEl = 17;
private int ruid;
private int ioEd;
private int peass;
private int nuted;
private int dre;
public Oiirt(int ruid, int ioEd) {
kume += 1;
this.ruid = ruid;
this.ioEd = ioEd;
}
public static void onStart() {
kume = 10;
}
public List<String> getIrElted() {
return irElted;
}
public int getRuid() {
return ruid;
}
public void setRuid(int ruid) {
this.ruid = ruid;
}
public int getIoEd() {
return ioEd;
}
public void setIoEd(int ioEd) {
this.ioEd = ioEd;
}
public int getPeass() {
return ioEd * ioEd;
}
public void setPeass(int peass) {
this.peass = peass;
}
private void setCishunify() {
irElted.add("olmon");
}
public int getNuted() {
return heEl * heEl;
}
public void setNuted(int nuted) {
this.nuted = nuted;
}
private void setSianify() {
irElted.add("ui");
}
public int getDre() {
return kume * kume;
}
public void setDre(int dre) {
this.dre = dre;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: