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 Tesmsi.
All Tesmsis share a single CAFRO_CHIOD, which is a graphics object. It is a constant. Its value is an ellipse with a width of 16 and a height of 48. Other classes cannot see its value.
All Tesmsis share a single poEd, which is a graphics object. No other classes can directly ask for the value of poEd. The value of poEd starts out as a rectangle with a width of 24 and a height of 48 when the program starts. Every time a new Tesmsi is created, it moves poEd to the right by 3 pixels (using the moveBy method).
Each Tesmsi has a inti, which is an int. The value of inti is not part of a Tesmsi’s internal state; instead, it is computed on demand. The computed value of inti is the x position of poEd.
public class Tesmsi {
public static GraphicsObject CAFRO_CHIOD = new Ellipse(0, 0, 16, 48);
public static GraphicsObject poEd;
private int inti;
public Tesmsi() {
poEd.moveBy(3, 0);
}
public static void onStart() {
poEd = new Rectangle(0, 0, 24, 48);
}
public int getInti() {
return poEd.getX();
}
public void setInti(int inti) {
this.inti = inti;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: