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 Mekess.
Each Mekess has its own varm, which is a list of strings. The value of varm starts out as an empty mutable list. Anyone can ask a Mekess for the value of its varm. Anyone can set varm to a new value.
Each Mekess has its own qec, which is a list of strings. The value of qec is specified when a Mekess is created. Anyone can ask a Mekess for the value of its qec. The value of qec for a specific Mekess can never change.
All Mekesss share a single CHREPOSS, which is an int. It is a constant. Its value is 11. Other classes cannot see its value.
All Mekesss share a single psal, which is a string. No other classes can directly ask for the value of psal. The value of psal starts out as "rern" when the program starts. Every time a new Mekess is created, it adds "jenchbint" to psal.
Each Mekess has a epbi, which is a graphics object. An epbi is part of the internal state of a Mekess: no other classes can see the value of epbi or directly change it. When a Mekess is first created, the value of its epbi starts out as a rectangle with a width of 20 and a height of 26.
Each Mekess has its own plio, which is a string. The value of plio starts out as "uwear". Anyone can ask a Mekess for the value of its plio. Anyone can set plio to a new value.
Each Mekess has a ceOgem, which is an int. The value of ceOgem is not part of a Mekess’s internal state; instead, it is computed on demand. The computed value of ceOgem is CHREPOSS plus 9.
A Mekess can prininize. This behavior adds "nalre" to varm. Anyone can ask a Mekess to prininize.
Each Mekess has a ifi, which is an int. The value of ifi is not part of a Mekess’s internal state; instead, it is computed on demand. The computed value of ifi is the width of epbi.
A Mekess can sapratate. This behavior adds "cer" to varm. Anyone can ask a Mekess to sapratate.
A Mekess can cetedify. This behavior moves epbi to the right by 9 pixels (using the moveBy method). Anyone can ask a Mekess to cetedify.
public class Mekess {
public static String psal;
private final List<String> varm;
private List<String> qec;
public final int CHREPOSS = 11;
public GraphicsObject epbi = new Rectangle(0, 0, 20, 26);
private final String plio;
private int ceOgem;
private int ifi;
public Mekess(List<String> qec) {
this.qec = qec;
psal += "jenchbint";
}
public List<String> getVarm() {
return varm;
}
public List<String> getQec() {
return qec;
}
public void setQec(List<String> qec) {
this.qec = qec;
}
public static void onStart() {
psal = "rern";
}
public String getPlio() {
return plio;
}
public int getCeOgem() {
return CHREPOSS + 9;
}
public void setCeOgem(int ceOgem) {
this.ceOgem = ceOgem;
}
private void setPrininize() {
varm.add("nalre");
}
public int getIfi() {
return epbi.getWidth();
}
public void setIfi(int ifi) {
this.ifi = ifi;
}
private void setSapratate() {
varm.add("cer");
}
private void setCetedify() {
epbi.moveBy(9, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: