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 Heangde.
All Heangdes share a single seEdnec, which is an int. No other classes can directly ask for the value of seEdnec. The value of seEdnec starts out as 5 when the program starts. Every time a new Heangde is created, it adds 3 to seEdnec.
Each Heangde has its own mio, which is a list of strings. The value of mio is specified when a Heangde is created. Anyone can ask a Heangde for the value of its mio. Anyone can set mio to a new value.
All Heangdes share a single RA_EPHES, which is a list of strings. It is a constant. Its value is ["mera", "stuthen", "chiaress"]. Other classes cannot see its value.
Each Heangde has its own derta, which is a list of strings. The value of derta is specified when a Heangde is created. Anyone can ask a Heangde for the value of its derta. The value of derta for a specific Heangde can never change.
Each Heangde has a iod, which is a graphics object. An iod is part of the internal state of a Heangde: no other classes can see the value of iod or directly change it. When a Heangde is first created, the value of its iod starts out as a rectangle with a width of 41 and a height of 29.
A Heangde can chocate. This behavior adds "aewsa" to mio. Anyone can ask a Heangde to chocate.
Each Heangde has a iac, which is an int. The value of iac is not part of a Heangde’s internal state; instead, it is computed on demand. The computed value of iac is seEdnec squared.
A Heangde can bunenate. This behavior adds "frourden" to mio. Anyone can ask a Heangde to bunenate.
Each Heangde has a reeem, which is an int. The value of reeem is not part of a Heangde’s internal state; instead, it is computed on demand. The computed value of reeem is seEdnec plus 6.
public class Heangde {
public static int seEdnec;
public static List<String> RA_EPHES = List.of("mera", "stuthen", "chiaress");
private final List<String> mio;
private List<String> derta;
public GraphicsObject iod = new Rectangle(0, 0, 41, 29);
private int iac;
private int reeem;
public Heangde(List<String> mio, List<String> derta) {
seEdnec += 3;
this.mio = mio;
this.derta = derta;
}
public static void onStart() {
seEdnec = 5;
}
public List<String> getMio() {
return mio;
}
public List<String> getDerta() {
return derta;
}
public void setDerta(List<String> derta) {
this.derta = derta;
}
private void setChocate() {
mio.add("aewsa");
}
public int getIac() {
return seEdnec * seEdnec;
}
public void setIac(int iac) {
this.iac = iac;
}
private void setBunenate() {
mio.add("frourden");
}
public int getReeem() {
return seEdnec + 6;
}
public void setReeem(int reeem) {
this.reeem = reeem;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: