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 Phacsfre.
All Phacsfres share a single pord, which is a graphics object. No other classes can directly ask for the value of pord. The value of pord starts out as a rectangle with a width of 27 and a height of 16 when the program starts. Every time a new Phacsfre is created, it moves pord to the right by 5 pixels (using the moveBy method).
public class Phacsfre {
public static GraphicsObject pord;
public Phacsfre() {
pord.moveBy(5, 0);
}
public static void onStart() {
pord = new Rectangle(0, 0, 27, 16);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: