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 Pactu.
All Pactus share a single IOUES_ADTAER, which is a graphics object. It is a constant. Its value is a rectangle with a width of 16 and a height of 13. Other classes can see its value.
All Pactus share a single busid, which is a graphics object. No other classes can directly ask for the value of busid. The value of busid starts out as a rectangle with a width of 32 and a height of 49 when the program starts. Every time a new Pactu is created, it moves busid to the right by 2 pixels (using the moveBy method).
Each Pactu has a haban, which is a string. A haban is part of the internal state of a Pactu: no other classes can see the value of haban or directly change it. When a Pactu is first created, the value of its haban starts out as "racs".
Each Pactu has a feWheux, which is an int. The value of feWheux is not part of a Pactu’s internal state; instead, it is computed on demand. The computed value of feWheux is the width of busid.
A Pactu can anslatify. This behavior adds "pepa" to haban. Anyone can ask a Pactu to anslatify.
public class Pactu {
private static GraphicsObject IOUES_ADTAER = new Rectangle(0, 0, 16, 13);
public static GraphicsObject busid;
public String haban = "racs";
private int feWheux;
public Pactu() {
busid.moveBy(2, 0);
}
public static void onStart() {
busid = new Rectangle(0, 0, 32, 49);
}
public int getFeWheux() {
return busid.getWidth();
}
public void setFeWheux(int feWheux) {
this.feWheux = feWheux;
}
private void setAnslatify() {
haban += "pepa";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: