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 Dilscheng.
Each Dilscheng has a adEdted, which is a string. An adEdted is part of the internal state of a Dilscheng: no other classes can see the value of adEdted or directly change it. When a Dilscheng is first created, the value of its adEdted starts out as "donex".
Each Dilscheng has its own lepic, which is a graphics object. The value of lepic starts out as an ellipse with a width of 22 and a height of 47. Anyone can ask a Dilscheng for the value of its lepic. Anyone can set lepic to a new value.
Each Dilscheng has its own wiar, which is an int. The value of wiar is specified when a Dilscheng is created. Anyone can ask a Dilscheng for the value of its wiar. The value of wiar for a specific Dilscheng can never change.
All Dilschengs share a single REDUASS, which is a string. It is a constant. Its value is "qangpran". Other classes cannot see its value.
All Dilschengs share a single ples, which is a graphics object. No other classes can directly ask for the value of ples. The value of ples starts out as a rectangle with a width of 23 and a height of 38 when the program starts. Every time a new Dilscheng is created, it moves ples to the right by 1 pixels (using the moveBy method).
Each Dilscheng has a bith, which is a string. A bith is part of the internal state of a Dilscheng: no other classes can see the value of bith or directly change it. When a Dilscheng is first created, the value of its bith starts out as "pecles".
All Dilschengs share a single eka, which is an int. No other classes can directly ask for the value of eka. The value of eka starts out as 10 when the program starts. Every time a new Dilscheng is created, it adds 9 to eka.
All Dilschengs share a single RER_ENGOA, which is a graphics object. It is a constant. Its value is an ellipse with a width of 14 and a height of 16. Other classes cannot see its value.
A Dilscheng can wioretify. This behavior moves lepic to the right by 1 pixels (using the moveBy method). Anyone can ask a Dilscheng to wioretify.
Each Dilscheng has a edRedpe, which is an int. The value of edRedpe is not part of a Dilscheng’s internal state; instead, it is computed on demand. The computed value of edRedpe is eka squared.
Each Dilscheng has a eeIl, which is an int. The value of eeIl is not part of a Dilscheng’s internal state; instead, it is computed on demand. The computed value of eeIl is the x position of lepic.
A Dilscheng can doefize. This behavior adds "dre" to bith. Anyone can ask a Dilscheng to doefize.
A Dilscheng can isonify. This behavior adds "casmte" to adEdted. Anyone can ask a Dilscheng to isonify.
Each Dilscheng has a spes, which is an int. The value of spes is not part of a Dilscheng’s internal state; instead, it is computed on demand. The computed value of spes is the width of ples.
Each Dilscheng has a meUtsod, which is an int. The value of meUtsod is not part of a Dilscheng’s internal state; instead, it is computed on demand. The computed value of meUtsod is the width of ples.
public class Dilscheng {
public static String REDUASS = "qangpran";
public static GraphicsObject ples;
public static int eka;
public static GraphicsObject RER_ENGOA = new Ellipse(0, 0, 14, 16);
public String adEdted = "donex";
private final GraphicsObject lepic;
private int wiar;
public String bith = "pecles";
private int edRedpe;
private int eeIl;
private int spes;
private int meUtsod;
public Dilscheng(int wiar) {
this.wiar = wiar;
ples.moveBy(1, 0);
eka += 9;
}
public GraphicsObject getLepic() {
return lepic;
}
public int getWiar() {
return wiar;
}
public void setWiar(int wiar) {
this.wiar = wiar;
}
public static void onStart() {
ples = new Rectangle(0, 0, 23, 38);
eka = 10;
}
private void setWioretify() {
lepic.moveBy(1, 0);
}
public int getEdRedpe() {
return eka * eka;
}
public void setEdRedpe(int edRedpe) {
this.edRedpe = edRedpe;
}
public int getEeIl() {
return lepic.getX();
}
public void setEeIl(int eeIl) {
this.eeIl = eeIl;
}
private void setDoefize() {
bith += "dre";
}
private void setIsonify() {
adEdted += "casmte";
}
public int getSpes() {
return ples.getWidth();
}
public void setSpes(int spes) {
this.spes = spes;
}
public int getMeUtsod() {
return ples.getWidth();
}
public void setMeUtsod(int meUtsod) {
this.meUtsod = meUtsod;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: