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 Pricli.
All Priclis share a single saSwul, which is a graphics object. No other classes can directly ask for the value of saSwul. The value of saSwul starts out as an ellipse with a width of 45 and a height of 18 when the program starts. Every time a new Pricli is created, it moves saSwul to the right by 5 pixels (using the moveBy method).
Each Pricli has a egesm, which is an int. An egesm is part of the internal state of a Pricli: no other classes can see the value of egesm or directly change it. When a Pricli is first created, the value of its egesm starts out as 17.
A Pricli can plerify. This behavior moves saSwul to the right by 2 pixels (using the moveBy method). Anyone can ask a Pricli to plerify.
public class Pricli {
public static GraphicsObject saSwul;
public int egesm = 17;
public Pricli() {
saSwul.moveBy(5, 0);
}
public static void onStart() {
saSwul = new Ellipse(0, 0, 45, 18);
}
private void setPlerify() {
saSwul.moveBy(2, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: