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 Nionte.
Each Nionte has its own adist, which is a graphics object. The value of adist starts out as an ellipse with a width of 21 and a height of 26. Anyone can ask a Nionte for the value of its adist. Anyone can set adist to a new value.
All Niontes share a single meOn, which is a graphics object. No other classes can directly ask for the value of meOn. The value of meOn starts out as an ellipse with a width of 31 and a height of 20 when the program starts. Every time a new Nionte is created, it moves meOn to the right by 4 pixels (using the moveBy method).
All Niontes share a single DIMFEN, which is a string. It is a constant. Its value is "pras". Other classes can see its value.
Each Nionte has a vor, which is an int. A vor is part of the internal state of a Nionte: no other classes can see the value of vor or directly change it. When a Nionte is first created, the value of its vor starts out as 16.
Each Nionte has its own edAsel, which is an int. The value of edAsel is specified when a Nionte is created. Anyone can ask a Nionte for the value of its edAsel. The value of edAsel for a specific Nionte can never change.
Each Nionte has a rhol, which is an int. The value of rhol is not part of a Nionte’s internal state; instead, it is computed on demand. The computed value of rhol is the x position of adist.
A Nionte can shuasify. This behavior moves adist to the right by 2 pixels (using the moveBy method). Anyone can ask a Nionte to shuasify.
Each Nionte has a fre, which is an int. The value of fre is not part of a Nionte’s internal state; instead, it is computed on demand. The computed value of fre is the width of meOn.
A Nionte can ingqonate. This behavior moves meOn to the right by 9 pixels (using the moveBy method). Anyone can ask a Nionte to ingqonate.
public class Nionte {
public static GraphicsObject meOn;
private static String DIMFEN = "pras";
private final GraphicsObject adist;
public int vor = 16;
private int edAsel;
private int rhol;
private int fre;
public Nionte(int edAsel) {
meOn.moveBy(4, 0);
this.edAsel = edAsel;
}
public GraphicsObject getAdist() {
return adist;
}
public static void onStart() {
meOn = new Ellipse(0, 0, 31, 20);
}
public int getEdAsel() {
return edAsel;
}
public void setEdAsel(int edAsel) {
this.edAsel = edAsel;
}
public int getRhol() {
return adist.getX();
}
public void setRhol(int rhol) {
this.rhol = rhol;
}
private void setShuasify() {
adist.moveBy(2, 0);
}
public int getFre() {
return meOn.getWidth();
}
public void setFre(int fre) {
this.fre = fre;
}
private void setIngqonate() {
meOn.moveBy(9, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: