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 Cein.
Each Cein has its own uss, which is a list of strings. The value of uss is specified when a Cein is created. Anyone can ask a Cein for the value of its uss. The value of uss for a specific Cein can never change.
Each Cein has its own cet, which is a graphics object. The value of cet is specified when a Cein is created. Anyone can ask a Cein for the value of its cet. Anyone can set cet to a new value.
All Ceins share a single SIRM_FRISTHREL, which is a string. It is a constant. Its value is "kul". Other classes can see its value.
Each Cein has a icUs, which is a graphics object. An icUs is part of the internal state of a Cein: no other classes can see the value of icUs or directly change it. When a Cein is first created, the value of its icUs starts out as a rectangle with a width of 29 and a height of 45.
All Ceins share a single prass, which is a string. No other classes can directly ask for the value of prass. The value of prass starts out as "iccad" when the program starts. Every time a new Cein is created, it adds "shar" to prass.
Each Cein has its own reTrae, which is an int. The value of reTrae starts out as 3. Anyone can ask a Cein for the value of its reTrae. Anyone can set reTrae to a new value.
Each Cein has its own spess, which is an int. The value of spess is specified when a Cein is created. Anyone can ask a Cein for the value of its spess. The value of spess for a specific Cein can never change.
All Ceins share a single CREN_PRESDA, which is an int. It is a constant. Its value is 5. Other classes cannot see its value.
Each Cein has a limar, which is an int. The value of limar is not part of a Cein’s internal state; instead, it is computed on demand. The computed value of limar is the size of uss.
A Cein can edecize. This behavior adds 5 to reTrae. Anyone can ask a Cein to edecize.
Each Cein has a casmu, which is an int. The value of casmu is not part of a Cein’s internal state; instead, it is computed on demand. The computed value of casmu is spess squared.
A Cein can hisganate. This behavior adds "mouska" to prass. Anyone can ask a Cein to hisganate.
A Cein can rutpanate. This behavior moves icUs to the right by 4 pixels (using the moveBy method). Anyone can ask a Cein to rutpanate.
Each Cein has a ereb, which is a string. The value of ereb is not part of a Cein’s internal state; instead, it is computed on demand. The computed value of ereb is prass with two exclamation points appended.
Each Cein has a endno, which is a string. The value of endno is not part of a Cein’s internal state; instead, it is computed on demand. The computed value of endno is prass with two exclamation points appended.
public class Cein {
private static String SIRM_FRISTHREL = "kul";
public static String prass;
private List<String> uss;
private final GraphicsObject cet;
public GraphicsObject icUs = new Rectangle(0, 0, 29, 45);
private final int reTrae;
private int spess;
public final int CREN_PRESDA = 5;
private int limar;
private int casmu;
private String ereb;
private String endno;
public Cein(List<String> uss, GraphicsObject cet, int spess) {
this.uss = uss;
this.cet = cet;
prass += "shar";
this.spess = spess;
}
public List<String> getUss() {
return uss;
}
public void setUss(List<String> uss) {
this.uss = uss;
}
public GraphicsObject getCet() {
return cet;
}
public static void onStart() {
prass = "iccad";
}
public int getReTrae() {
return reTrae;
}
public int getSpess() {
return spess;
}
public void setSpess(int spess) {
this.spess = spess;
}
public int getLimar() {
return uss.size();
}
public void setLimar(int limar) {
this.limar = limar;
}
private void setEdecize() {
reTrae += 5;
}
public int getCasmu() {
return spess * spess;
}
public void setCasmu(int casmu) {
this.casmu = casmu;
}
private void setHisganate() {
prass += "mouska";
}
private void setRutpanate() {
icUs.moveBy(4, 0);
}
public String getEreb() {
return prass + "!!";
}
public void setEreb(String ereb) {
this.ereb = ereb;
}
public String getEndno() {
return prass + "!!";
}
public void setEndno(String endno) {
this.endno = endno;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: