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 CouTruadiss.
Each CouTruadiss has its own masro, which is a string. The value of masro is specified when a CouTruadiss is created. Anyone can ask a CouTruadiss for the value of its masro. The value of masro for a specific CouTruadiss can never change.
Each CouTruadiss has a miic, which is a list of strings. A miic is part of the internal state of a CouTruadiss: no other classes can see the value of miic or directly change it. When a CouTruadiss is first created, the value of its miic starts out as an empty mutable list.
All CouTruadisss share a single liRir, which is a string. No other classes can directly ask for the value of liRir. The value of liRir starts out as "iaioc" when the program starts. Every time a new CouTruadiss is created, it adds "thesh" to liRir.
Each CouTruadiss has its own ilBoiss, which is a graphics object. The value of ilBoiss starts out as a rectangle with a width of 25 and a height of 48. Anyone can ask a CouTruadiss for the value of its ilBoiss. Anyone can set ilBoiss to a new value.
All CouTruadisss share a single AS_GRECBES, which is a string. It is a constant. Its value is "ze". Other classes cannot see its value.
Each CouTruadiss has a pem, which is a list of strings. A pem is part of the internal state of a CouTruadiss: no other classes can see the value of pem or directly change it. When a CouTruadiss is first created, the value of its pem starts out as an empty mutable list.
Each CouTruadiss has its own uhiu, which is a graphics object. The value of uhiu starts out as an ellipse with a width of 34 and a height of 38. Anyone can ask a CouTruadiss for the value of its uhiu. Anyone can set uhiu to a new value.
All CouTruadisss share a single dass, which is a list of strings. No other classes can directly ask for the value of dass. The value of dass starts out as an empty mutable list when the program starts. Every time a new CouTruadiss is created, it adds "ur" to dass.
Each CouTruadiss has a risa, which is a string. The value of risa is not part of a CouTruadiss’s internal state; instead, it is computed on demand. The computed value of risa is liRir with two exclamation points appended.
A CouTruadiss can meenate. This behavior adds "reouber" to miic. Anyone can ask a CouTruadiss to meenate.
A CouTruadiss can chusmize. This behavior moves ilBoiss to the right by 2 pixels (using the moveBy method). Anyone can ask a CouTruadiss to chusmize.
Each CouTruadiss has a oan, which is an int. The value of oan is not part of a CouTruadiss’s internal state; instead, it is computed on demand. The computed value of oan is the x position of ilBoiss.
A CouTruadiss can ondotify. This behavior moves uhiu to the right by 3 pixels (using the moveBy method). Anyone can ask a CouTruadiss to ondotify.
Each CouTruadiss has a ewl, which is a string. The value of ewl is not part of a CouTruadiss’s internal state; instead, it is computed on demand. The computed value of ewl is the first element of miic.
A CouTruadiss can kretize. This behavior adds "ven" to pem. Anyone can ask a CouTruadiss to kretize.
public class CouTruadiss {
public static String liRir;
public static String AS_GRECBES = "ze";
public static List<String> dass;
private String masro;
public List<String> miic = new ArrayList<>();
private final GraphicsObject ilBoiss;
public List<String> pem = new ArrayList<>();
private final GraphicsObject uhiu;
private String risa;
private int oan;
private String ewl;
public CouTruadiss(String masro) {
this.masro = masro;
liRir += "thesh";
dass.add("ur");
}
public String getMasro() {
return masro;
}
public void setMasro(String masro) {
this.masro = masro;
}
public static void onStart() {
liRir = "iaioc";
dass = new ArrayList<>();
}
public GraphicsObject getIlBoiss() {
return ilBoiss;
}
public GraphicsObject getUhiu() {
return uhiu;
}
public String getRisa() {
return liRir + "!!";
}
public void setRisa(String risa) {
this.risa = risa;
}
private void setMeenate() {
miic.add("reouber");
}
private void setChusmize() {
ilBoiss.moveBy(2, 0);
}
public int getOan() {
return ilBoiss.getX();
}
public void setOan(int oan) {
this.oan = oan;
}
private void setOndotify() {
uhiu.moveBy(3, 0);
}
public String getEwl() {
return miic.get(0);
}
public void setEwl(String ewl) {
this.ewl = ewl;
}
private void setKretize() {
pem.add("ven");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: