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 Sevou.
Each Sevou has a dic, which is an int. A dic is part of the internal state of a Sevou: no other classes can see the value of dic or directly change it. When a Sevou is first created, the value of its dic starts out as 14.
Each Sevou has its own piEn, which is a string. The value of piEn is specified when a Sevou is created. Anyone can ask a Sevou for the value of its piEn. The value of piEn for a specific Sevou can never change.
All Sevous share a single seOdla, which is a list of strings. No other classes can directly ask for the value of seOdla. The value of seOdla starts out as an empty mutable list when the program starts. Every time a new Sevou is created, it adds "o" to seOdla.
All Sevous share a single TIO_CLOR, which is a list of strings. It is a constant. Its value is ["we", "ungbrix"]. Other classes cannot see its value.
Each Sevou has its own scerp, which is a string. The value of scerp starts out as "liaia". Anyone can ask a Sevou for the value of its scerp. Anyone can set scerp to a new value.
Each Sevou has its own mocos, which is a graphics object. The value of mocos is specified when a Sevou is created. Anyone can ask a Sevou for the value of its mocos. The value of mocos for a specific Sevou can never change.
All Sevous share a single quje, which is a list of strings. No other classes can directly ask for the value of quje. The value of quje starts out as an empty mutable list when the program starts. Every time a new Sevou is created, it adds "ha" to quje.
A Sevou can soolify. This behavior adds "searjiom" to quje. Anyone can ask a Sevou to soolify.
Each Sevou has a mical, which is an int. The value of mical is not part of a Sevou’s internal state; instead, it is computed on demand. The computed value of mical is dic squared.
Each Sevou has a har, which is an int. The value of har is not part of a Sevou’s internal state; instead, it is computed on demand. The computed value of har is the length of piEn.
A Sevou can voudify. This behavior adds "dest" to quje. Anyone can ask a Sevou to voudify.
Each Sevou has a assu, which is an int. The value of assu is not part of a Sevou’s internal state; instead, it is computed on demand. The computed value of assu is the size of quje.
A Sevou can breenize. This behavior adds "picpro" to seOdla. Anyone can ask a Sevou to breenize.
public class Sevou {
public static List<String> seOdla;
public static List<String> TIO_CLOR = List.of("we", "ungbrix");
public static List<String> quje;
public int dic = 14;
private String piEn;
private final String scerp;
private GraphicsObject mocos;
private int mical;
private int har;
private int assu;
public Sevou(String piEn, GraphicsObject mocos) {
this.piEn = piEn;
seOdla.add("o");
this.mocos = mocos;
quje.add("ha");
}
public String getPiEn() {
return piEn;
}
public void setPiEn(String piEn) {
this.piEn = piEn;
}
public static void onStart() {
seOdla = new ArrayList<>();
quje = new ArrayList<>();
}
public String getScerp() {
return scerp;
}
public GraphicsObject getMocos() {
return mocos;
}
public void setMocos(GraphicsObject mocos) {
this.mocos = mocos;
}
private void setSoolify() {
quje.add("searjiom");
}
public int getMical() {
return dic * dic;
}
public void setMical(int mical) {
this.mical = mical;
}
public int getHar() {
return piEn.length();
}
public void setHar(int har) {
this.har = har;
}
private void setVoudify() {
quje.add("dest");
}
public int getAssu() {
return quje.size();
}
public void setAssu(int assu) {
this.assu = assu;
}
private void setBreenize() {
seOdla.add("picpro");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: