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 Hiarrusm.
Each Hiarrusm has its own orpod, which is an int. The value of orpod is specified when a Hiarrusm is created. Anyone can ask a Hiarrusm for the value of its orpod. The value of orpod for a specific Hiarrusm can never change.
Each Hiarrusm has a psuc, which is an int. A psuc is part of the internal state of a Hiarrusm: no other classes can see the value of psuc or directly change it. When a Hiarrusm is first created, the value of its psuc starts out as 2.
All Hiarrusms share a single QURUD_FELTHRIS, which is a list of strings. It is a constant. Its value is ["trissram", "ci", "ir"]. Other classes cannot see its value.
All Hiarrusms share a single goph, which is a list of strings. No other classes can directly ask for the value of goph. The value of goph starts out as an empty mutable list when the program starts. Every time a new Hiarrusm is created, it adds "jecboi" to goph.
Each Hiarrusm has its own dair, which is a list of strings. The value of dair starts out as an empty mutable list. Anyone can ask a Hiarrusm for the value of its dair. Anyone can set dair to a new value.
Each Hiarrusm has its own bie, which is an int. The value of bie starts out as 8. Anyone can ask a Hiarrusm for the value of its bie. Anyone can set bie to a new value.
All Hiarrusms share a single CHIAIN, which is a list of strings. It is a constant. Its value is ["phasan", "chiss"]. Other classes can see its value.
Each Hiarrusm has a maSqal, which is an int. The value of maSqal is not part of a Hiarrusm’s internal state; instead, it is computed on demand. The computed value of maSqal is the size of CHIAIN.
A Hiarrusm can plesate. This behavior adds "gopoo" to goph. Anyone can ask a Hiarrusm to plesate.
Each Hiarrusm has a qaEssa, which is a string. The value of qaEssa is not part of a Hiarrusm’s internal state; instead, it is computed on demand. The computed value of qaEssa is the first element of QURUD_FELTHRIS.
A Hiarrusm can eewerate. This behavior adds 6 to psuc. Anyone can ask a Hiarrusm to eewerate.
Each Hiarrusm has a ecAo, which is a string. The value of ecAo is not part of a Hiarrusm’s internal state; instead, it is computed on demand. The computed value of ecAo is the first element of QURUD_FELTHRIS.
A Hiarrusm can ceeanify. This behavior adds 5 to psuc. Anyone can ask a Hiarrusm to ceeanify.
public class Hiarrusm {
public static List<String> QURUD_FELTHRIS = List.of("trissram", "ci", "ir");
public static List<String> goph;
private static List<String> CHIAIN = List.of("phasan", "chiss");
private int orpod;
public int psuc = 2;
private final List<String> dair;
private final int bie;
private int maSqal;
private String qaEssa;
private String ecAo;
public Hiarrusm(int orpod) {
this.orpod = orpod;
goph.add("jecboi");
}
public int getOrpod() {
return orpod;
}
public void setOrpod(int orpod) {
this.orpod = orpod;
}
public static void onStart() {
goph = new ArrayList<>();
}
public List<String> getDair() {
return dair;
}
public int getBie() {
return bie;
}
public int getMaSqal() {
return CHIAIN.size();
}
public void setMaSqal(int maSqal) {
this.maSqal = maSqal;
}
private void setPlesate() {
goph.add("gopoo");
}
public String getQaEssa() {
return QURUD_FELTHRIS.get(0);
}
public void setQaEssa(String qaEssa) {
this.qaEssa = qaEssa;
}
private void setEewerate() {
psuc += 6;
}
public String getEcAo() {
return QURUD_FELTHRIS.get(0);
}
public void setEcAo(String ecAo) {
this.ecAo = ecAo;
}
private void setCeeanify() {
psuc += 5;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: