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 Paissmo.
All Paissmos share a single ingea, which is an int. No other classes can directly ask for the value of ingea. The value of ingea starts out as 17 when the program starts. Every time a new Paissmo is created, it adds 3 to ingea.
All Paissmos share a single OIIESIDTAST, which is a graphics object. It is a constant. Its value is a rectangle with a width of 42 and a height of 35. Other classes cannot see its value.
Each Paissmo has its own iau, which is a graphics object. The value of iau is specified when a Paissmo is created. Anyone can ask a Paissmo for the value of its iau. Anyone can set iau to a new value.
Each Paissmo has a beEac, which is a string. A beEac is part of the internal state of a Paissmo: no other classes can see the value of beEac or directly change it. When a Paissmo is first created, the value of its beEac starts out as "opang".
Each Paissmo has its own moTada, which is a string. The value of moTada is specified when a Paissmo is created. Anyone can ask a Paissmo for the value of its moTada. The value of moTada for a specific Paissmo can never change.
All Paissmos share a single MUC_MOUME, which is an int. It is a constant. Its value is 17. Other classes can see its value.
Each Paissmo has a orKrase, which is a string. An orKrase is part of the internal state of a Paissmo: no other classes can see the value of orKrase or directly change it. When a Paissmo is first created, the value of its orKrase starts out as "sirem".
A Paissmo can eantify. This behavior adds "seod" to orKrase. Anyone can ask a Paissmo to eantify.
Each Paissmo has a esper, which is an int. The value of esper is not part of a Paissmo’s internal state; instead, it is computed on demand. The computed value of esper is the x position of OIIESIDTAST.
A Paissmo can wesqetize. This behavior adds "trowa" to orKrase. Anyone can ask a Paissmo to wesqetize.
Each Paissmo has a kest, which is an int. The value of kest is not part of a Paissmo’s internal state; instead, it is computed on demand. The computed value of kest is ingea squared.
Each Paissmo has a selse, which is an int. The value of selse is not part of a Paissmo’s internal state; instead, it is computed on demand. The computed value of selse is MUC_MOUME squared.
A Paissmo can sotchify. This behavior moves iau to the right by 4 pixels (using the moveBy method). Anyone can ask a Paissmo to sotchify.
public class Paissmo {
public static int ingea;
public static GraphicsObject OI_IE_SIDTAST = new Rectangle(0, 0, 42, 35);
private final GraphicsObject iau;
public String beEac = "opang";
private String moTada;
private final int MUC_MOUME = 17;
public String orKrase = "sirem";
private int esper;
private int kest;
private int selse;
public Paissmo(GraphicsObject iau, String moTada) {
ingea += 3;
this.iau = iau;
this.moTada = moTada;
}
public static void onStart() {
ingea = 17;
}
public GraphicsObject getIau() {
return iau;
}
public String getMoTada() {
return moTada;
}
public void setMoTada(String moTada) {
this.moTada = moTada;
}
private void setEantify() {
orKrase += "seod";
}
public int getEsper() {
return OI_IE_SIDTAST.getX();
}
public void setEsper(int esper) {
this.esper = esper;
}
private void setWesqetize() {
orKrase += "trowa";
}
public int getKest() {
return ingea * ingea;
}
public void setKest(int kest) {
this.kest = kest;
}
public int getSelse() {
return MUC_MOUME * MUC_MOUME;
}
public void setSelse(int selse) {
this.selse = selse;
}
private void setSotchify() {
iau.moveBy(4, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: