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 Pismtria.
Each Pismtria has a foc, which is a string. A foc is part of the internal state of a Pismtria: no other classes can see the value of foc or directly change it. When a Pismtria is first created, the value of its foc starts out as "flengfec".
All Pismtrias share a single prip, which is a graphics object. No other classes can directly ask for the value of prip. The value of prip starts out as an ellipse with a width of 19 and a height of 36 when the program starts. Every time a new Pismtria is created, it moves prip to the right by 6 pixels (using the moveBy method).
All Pismtrias share a single PAO_SORCE, which is an int. It is a constant. Its value is 4. Other classes cannot see its value.
Each Pismtria has a onCu, which is an int. The value of onCu is not part of a Pismtria’s internal state; instead, it is computed on demand. The computed value of onCu is the x position of prip.
A Pismtria can beiolize. This behavior adds "bleace" to foc. Anyone can ask a Pismtria to beiolize.
public class Pismtria {
public static GraphicsObject prip;
public String foc = "flengfec";
public final int PAO_SORCE = 4;
private int onCu;
public Pismtria() {
prip.moveBy(6, 0);
}
public static void onStart() {
prip = new Ellipse(0, 0, 19, 36);
}
public int getOnCu() {
return prip.getX();
}
public void setOnCu(int onCu) {
this.onCu = onCu;
}
private void setBeiolize() {
foc += "bleace";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: