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 HeaMiormu.
Each HeaMiormu has its own gatra, which is an int. The value of gatra is specified when a HeaMiormu is created. Anyone can ask a HeaMiormu for the value of its gatra. The value of gatra for a specific HeaMiormu can never change.
All HeaMiormus share a single CUS_JOLJOND, which is a string. It is a constant. Its value is "to". Other classes can see its value.
Each HeaMiormu has a caVo, which is an int. A caVo is part of the internal state of a HeaMiormu: no other classes can see the value of caVo or directly change it. When a HeaMiormu is first created, the value of its caVo starts out as 18.
Each HeaMiormu has its own bleac, which is a string. The value of bleac is specified when a HeaMiormu is created. Anyone can ask a HeaMiormu for the value of its bleac. Anyone can set bleac to a new value.
All HeaMiormus share a single orme, which is an int. No other classes can directly ask for the value of orme. The value of orme starts out as 3 when the program starts. Every time a new HeaMiormu is created, it adds 8 to orme.
Each HeaMiormu has a poSa, which is an int. A poSa is part of the internal state of a HeaMiormu: no other classes can see the value of poSa or directly change it. When a HeaMiormu is first created, the value of its poSa starts out as 4.
All HeaMiormus share a single nur, which is a string. No other classes can directly ask for the value of nur. The value of nur starts out as "edten" when the program starts. Every time a new HeaMiormu is created, it adds "u" to nur.
Each HeaMiormu has a thren, which is an int. The value of thren is not part of a HeaMiormu’s internal state; instead, it is computed on demand. The computed value of thren is orme plus 8.
A HeaMiormu can afongize. This behavior adds "bevan" to nur. Anyone can ask a HeaMiormu to afongize.
Each HeaMiormu has a elOrph, which is an int. The value of elOrph is not part of a HeaMiormu’s internal state; instead, it is computed on demand. The computed value of elOrph is caVo plus 9.
A HeaMiormu can clellify. This behavior adds "qo" to bleac. Anyone can ask a HeaMiormu to clellify.
A HeaMiormu can siddilize. This behavior adds "viste" to nur. Anyone can ask a HeaMiormu to siddilize.
Each HeaMiormu has a maen, which is an int. The value of maen is not part of a HeaMiormu’s internal state; instead, it is computed on demand. The computed value of maen is caVo plus 2.
public class HeaMiormu {
private static String CUS_JOLJOND = "to";
public static int orme;
public static String nur;
private int gatra;
public int caVo = 18;
private final String bleac;
public int poSa = 4;
private int thren;
private int elOrph;
private int maen;
public HeaMiormu(int gatra, String bleac) {
this.gatra = gatra;
this.bleac = bleac;
orme += 8;
nur += "u";
}
public int getGatra() {
return gatra;
}
public void setGatra(int gatra) {
this.gatra = gatra;
}
public String getBleac() {
return bleac;
}
public static void onStart() {
orme = 3;
nur = "edten";
}
public int getThren() {
return orme + 8;
}
public void setThren(int thren) {
this.thren = thren;
}
private void setAfongize() {
nur += "bevan";
}
public int getElOrph() {
return caVo + 9;
}
public void setElOrph(int elOrph) {
this.elOrph = elOrph;
}
private void setClellify() {
bleac += "qo";
}
private void setSiddilize() {
nur += "viste";
}
public int getMaen() {
return caVo + 2;
}
public void setMaen(int maen) {
this.maen = maen;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: