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 Dansqe.
All Dansqes share a single weped, which is a string. No other classes can directly ask for the value of weped. The value of weped starts out as "pruche" when the program starts. Every time a new Dansqe is created, it adds "unt" to weped.
All Dansqes share a single IOMUBIDPISM, which is a graphics object. It is a constant. Its value is an ellipse with a width of 31 and a height of 25. Other classes can see its value.
Each Dansqe has a cuDezio, which is a graphics object. A cuDezio is part of the internal state of a Dansqe: no other classes can see the value of cuDezio or directly change it. When a Dansqe is first created, the value of its cuDezio starts out as a rectangle with a width of 42 and a height of 22.
Each Dansqe has its own mePren, which is a string. The value of mePren is specified when a Dansqe is created. Anyone can ask a Dansqe for the value of its mePren. The value of mePren for a specific Dansqe can never change.
Each Dansqe has its own helos, which is an int. The value of helos starts out as 11. Anyone can ask a Dansqe for the value of its helos. Anyone can set helos to a new value.
A Dansqe can vabitate. This behavior moves cuDezio to the right by 6 pixels (using the moveBy method). Anyone can ask a Dansqe to vabitate.
Each Dansqe has a pueid, which is a string. The value of pueid is not part of a Dansqe’s internal state; instead, it is computed on demand. The computed value of pueid is mePren with two exclamation points appended.
Each Dansqe has a oic, which is an int. The value of oic is not part of a Dansqe’s internal state; instead, it is computed on demand. The computed value of oic is the x position of IOMUBIDPISM.
A Dansqe can holonate. This behavior adds "bidhint" to weped. Anyone can ask a Dansqe to holonate.
public class Dansqe {
public static String weped;
private static GraphicsObject IO_MU_BIDPISM = new Ellipse(0, 0, 31, 25);
public GraphicsObject cuDezio = new Rectangle(0, 0, 42, 22);
private String mePren;
private final int helos;
private String pueid;
private int oic;
public Dansqe(String mePren) {
weped += "unt";
this.mePren = mePren;
}
public static void onStart() {
weped = "pruche";
}
public String getMePren() {
return mePren;
}
public void setMePren(String mePren) {
this.mePren = mePren;
}
public int getHelos() {
return helos;
}
private void setVabitate() {
cuDezio.moveBy(6, 0);
}
public String getPueid() {
return mePren + "!!";
}
public void setPueid(String pueid) {
this.pueid = pueid;
}
public int getOic() {
return IO_MU_BIDPISM.getX();
}
public void setOic(int oic) {
this.oic = oic;
}
private void setHolonate() {
weped += "bidhint";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: