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 PagDivir.
Each PagDivir has its own iaSeff, which is a string. The value of iaSeff starts out as "en". Anyone can ask a PagDivir for the value of its iaSeff. Anyone can set iaSeff to a new value.
Each PagDivir has its own gerbi, which is an int. The value of gerbi is specified when a PagDivir is created. Anyone can ask a PagDivir for the value of its gerbi. The value of gerbi for a specific PagDivir can never change.
All PagDivirs share a single ert, which is a list of strings. No other classes can directly ask for the value of ert. The value of ert starts out as an empty mutable list when the program starts. Every time a new PagDivir is created, it adds "soism" to ert.
Each PagDivir has a mua, which is a graphics object. A mua is part of the internal state of a PagDivir: no other classes can see the value of mua or directly change it. When a PagDivir is first created, the value of its mua starts out as an ellipse with a width of 13 and a height of 24.
All PagDivirs share a single OSS_BECA, which is an int. It is a constant. Its value is 1. Other classes can see its value.
All PagDivirs share a single naIsser, which is a string. No other classes can directly ask for the value of naIsser. The value of naIsser starts out as "estzess" when the program starts. Every time a new PagDivir is created, it adds "qur" to naIsser.
A PagDivir can iprolate. This behavior adds "socgent" to ert. Anyone can ask a PagDivir to iprolate.
Each PagDivir has a menal, which is a string. The value of menal is not part of a PagDivir’s internal state; instead, it is computed on demand. The computed value of menal is naIsser with two exclamation points appended.
Each PagDivir has a boeol, which is an int. The value of boeol is not part of a PagDivir’s internal state; instead, it is computed on demand. The computed value of boeol is gerbi squared.
A PagDivir can swaetify. This behavior adds "pionti" to iaSeff. Anyone can ask a PagDivir to swaetify.
A PagDivir can oeounate. This behavior adds "el" to naIsser. Anyone can ask a PagDivir to oeounate.
public class PagDivir {
public static List<String> ert;
public static String naIsser;
private final String iaSeff;
private int gerbi;
public GraphicsObject mua = new Ellipse(0, 0, 13, 24);
private final int OSS_BECA = 1;
private String menal;
private int boeol;
public PagDivir(int gerbi) {
this.gerbi = gerbi;
ert.add("soism");
naIsser += "qur";
}
public String getIaSeff() {
return iaSeff;
}
public int getGerbi() {
return gerbi;
}
public void setGerbi(int gerbi) {
this.gerbi = gerbi;
}
public static void onStart() {
ert = new ArrayList<>();
naIsser = "estzess";
}
private void setIprolate() {
ert.add("socgent");
}
public String getMenal() {
return naIsser + "!!";
}
public void setMenal(String menal) {
this.menal = menal;
}
public int getBoeol() {
return gerbi * gerbi;
}
public void setBoeol(int boeol) {
this.boeol = boeol;
}
private void setSwaetify() {
iaSeff += "pionti";
}
private void setOeounate() {
naIsser += "el";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: