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 Whusscau.
Each Whusscau has a imsi, which is a graphics object. An imsi is part of the internal state of a Whusscau: no other classes can see the value of imsi or directly change it. When a Whusscau is first created, the value of its imsi starts out as an ellipse with a width of 17 and a height of 25.
All Whusscaus share a single PIANPUSH, which is a string. It is a constant. Its value is "toson". Other classes cannot see its value.
Each Whusscau has its own caUpis, which is an int. The value of caUpis starts out as 18. Anyone can ask a Whusscau for the value of its caUpis. Anyone can set caUpis to a new value.
Each Whusscau has its own kasor, which is a list of strings. The value of kasor is specified when a Whusscau is created. Anyone can ask a Whusscau for the value of its kasor. The value of kasor for a specific Whusscau can never change.
All Whusscaus share a single iaTewar, which is a graphics object. No other classes can directly ask for the value of iaTewar. The value of iaTewar starts out as a rectangle with a width of 15 and a height of 46 when the program starts. Every time a new Whusscau is created, it moves iaTewar to the right by 4 pixels (using the moveBy method).
All Whusscaus share a single udAnec, which is a string. No other classes can directly ask for the value of udAnec. The value of udAnec starts out as "ra" when the program starts. Every time a new Whusscau is created, it adds "sepre" to udAnec.
Each Whusscau has its own borha, which is a graphics object. The value of borha starts out as a rectangle with a width of 24 and a height of 37. Anyone can ask a Whusscau for the value of its borha. Anyone can set borha to a new value.
Each Whusscau has a pios, which is an int. The value of pios is not part of a Whusscau’s internal state; instead, it is computed on demand. The computed value of pios is the length of PIANPUSH.
A Whusscau can orstify. This behavior adds 8 to caUpis. Anyone can ask a Whusscau to orstify.
A Whusscau can sponify. This behavior moves imsi to the right by 1 pixels (using the moveBy method). Anyone can ask a Whusscau to sponify.
Each Whusscau has a oiss, which is an int. The value of oiss is not part of a Whusscau’s internal state; instead, it is computed on demand. The computed value of oiss is the length of udAnec.
A Whusscau can todenify. This behavior moves iaTewar to the right by 5 pixels (using the moveBy method). Anyone can ask a Whusscau to todenify.
Each Whusscau has a palri, which is an int. The value of palri is not part of a Whusscau’s internal state; instead, it is computed on demand. The computed value of palri is the x position of borha.
public class Whusscau {
public static String PIANPUSH = "toson";
public static GraphicsObject iaTewar;
public static String udAnec;
public GraphicsObject imsi = new Ellipse(0, 0, 17, 25);
private final int caUpis;
private List<String> kasor;
private final GraphicsObject borha;
private int pios;
private int oiss;
private int palri;
public Whusscau(List<String> kasor) {
this.kasor = kasor;
iaTewar.moveBy(4, 0);
udAnec += "sepre";
}
public int getCaUpis() {
return caUpis;
}
public List<String> getKasor() {
return kasor;
}
public void setKasor(List<String> kasor) {
this.kasor = kasor;
}
public static void onStart() {
iaTewar = new Rectangle(0, 0, 15, 46);
udAnec = "ra";
}
public GraphicsObject getBorha() {
return borha;
}
public int getPios() {
return PIANPUSH.length();
}
public void setPios(int pios) {
this.pios = pios;
}
private void setOrstify() {
caUpis += 8;
}
private void setSponify() {
imsi.moveBy(1, 0);
}
public int getOiss() {
return udAnec.length();
}
public void setOiss(int oiss) {
this.oiss = oiss;
}
private void setTodenify() {
iaTewar.moveBy(5, 0);
}
public int getPalri() {
return borha.getX();
}
public void setPalri(int palri) {
this.palri = palri;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: