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 Essknim.
All Essknims share a single RO_SAIPT, which is a graphics object. It is a constant. Its value is an ellipse with a width of 23 and a height of 41. Other classes cannot see its value.
Each Essknim has its own bue, which is an int. The value of bue is specified when a Essknim is created. Anyone can ask an Essknim for the value of its bue. The value of bue for a specific Essknim can never change.
Each Essknim has a riane, which is a graphics object. A riane is part of the internal state of an Essknim: no other classes can see the value of riane or directly change it. When an Essknim is first created, the value of its riane starts out as a rectangle with a width of 24 and a height of 34.
All Essknims share a single coa, which is an int. No other classes can directly ask for the value of coa. The value of coa starts out as 15 when the program starts. Every time a new Essknim is created, it adds 2 to coa.
Each Essknim has its own eeCer, which is a list of strings. The value of eeCer is specified when a Essknim is created. Anyone can ask an Essknim for the value of its eeCer. Anyone can set eeCer to a new value.
Each Essknim has its own arMo, which is a list of strings. The value of arMo starts out as an empty mutable list. Anyone can ask an Essknim for the value of its arMo. Anyone can set arMo to a new value.
Each Essknim has a morqa, which is an int. The value of morqa is not part of an Essknim’s internal state; instead, it is computed on demand. The computed value of morqa is bue squared.
An Essknim can pecify. This behavior adds 9 to coa. Anyone can ask an Essknim to pecify.
An Essknim can nidulify. This behavior adds 6 to coa. Anyone can ask an Essknim to nidulify.
Each Essknim has a drin, which is a string. The value of drin is not part of an Essknim’s internal state; instead, it is computed on demand. The computed value of drin is the first element of arMo.
Each Essknim has a jiNec, which is an int. The value of jiNec is not part of an Essknim’s internal state; instead, it is computed on demand. The computed value of jiNec is the size of eeCer.
public class Essknim {
public static GraphicsObject RO_SAIPT = new Ellipse(0, 0, 23, 41);
public static int coa;
private int bue;
public GraphicsObject riane = new Rectangle(0, 0, 24, 34);
private final List<String> eeCer;
private final List<String> arMo;
private int morqa;
private String drin;
private int jiNec;
public Essknim(int bue, List<String> eeCer) {
this.bue = bue;
coa += 2;
this.eeCer = eeCer;
}
public int getBue() {
return bue;
}
public void setBue(int bue) {
this.bue = bue;
}
public static void onStart() {
coa = 15;
}
public List<String> getEeCer() {
return eeCer;
}
public List<String> getArMo() {
return arMo;
}
public int getMorqa() {
return bue * bue;
}
public void setMorqa(int morqa) {
this.morqa = morqa;
}
private void setPecify() {
coa += 9;
}
private void setNidulify() {
coa += 6;
}
public String getDrin() {
return arMo.get(0);
}
public void setDrin(String drin) {
this.drin = drin;
}
public int getJiNec() {
return eeCer.size();
}
public void setJiNec(int jiNec) {
this.jiNec = jiNec;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: