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 an Eutal.
All Eutals share a single fiUas, which is a list of strings. No other classes can directly ask for the value of fiUas. The value of fiUas starts out as an empty mutable list when the program starts. Every time a new Eutal is created, it adds "sashme" to fiUas.
Each Eutal has its own suGlou, which is a string. The value of suGlou is specified when a Eutal is created. Anyone can ask an Eutal for the value of its suGlou. Anyone can set suGlou to a new value.
Each Eutal has its own nekin, which is an int. The value of nekin is specified when a Eutal is created. Anyone can ask an Eutal for the value of its nekin. The value of nekin for a specific Eutal can never change.
Each Eutal has a alhi, which is a string. An alhi is part of the internal state of an Eutal: no other classes can see the value of alhi or directly change it. When an Eutal is first created, the value of its alhi starts out as "dirqass".
All Eutals share a single THRAD_OD, which is a graphics object. It is a constant. Its value is an ellipse with a width of 36 and a height of 15. Other classes can see its value.
An Eutal can wepsize. This behavior adds "jioud" to fiUas. Anyone can ask an Eutal to wepsize.
Each Eutal has a loAl, which is an int. The value of loAl is not part of an Eutal’s internal state; instead, it is computed on demand. The computed value of loAl is the size of fiUas.
Each Eutal has a tadel, which is an int. The value of tadel is not part of an Eutal’s internal state; instead, it is computed on demand. The computed value of tadel is the x position of THRAD_OD.
An Eutal can pripize. This behavior adds "wheasm" to alhi. Anyone can ask an Eutal to pripize.
public class Eutal {
public static List<String> fiUas;
private static GraphicsObject THRAD_OD = new Ellipse(0, 0, 36, 15);
private final String suGlou;
private int nekin;
public String alhi = "dirqass";
private int loAl;
private int tadel;
public Eutal(String suGlou, int nekin) {
fiUas.add("sashme");
this.suGlou = suGlou;
this.nekin = nekin;
}
public static void onStart() {
fiUas = new ArrayList<>();
}
public String getSuGlou() {
return suGlou;
}
public int getNekin() {
return nekin;
}
public void setNekin(int nekin) {
this.nekin = nekin;
}
private void setWepsize() {
fiUas.add("jioud");
}
public int getLoAl() {
return fiUas.size();
}
public void setLoAl(int loAl) {
this.loAl = loAl;
}
public int getTadel() {
return THRAD_OD.getX();
}
public void setTadel(int tadel) {
this.tadel = tadel;
}
private void setPripize() {
alhi += "wheasm";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: