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 Oihos.
Each Oihos has its own qen, which is an int. The value of qen is specified when a Oihos is created. Anyone can ask an Oihos for the value of its qen. The value of qen for a specific Oihos can never change.
All Oihoss share a single phe, which is a graphics object. No other classes can directly ask for the value of phe. The value of phe starts out as an ellipse with a width of 47 and a height of 38 when the program starts. Every time a new Oihos is created, it moves phe to the right by 1 pixels (using the moveBy method).
All Oihoss share a single TOBRO_WOORSSOUSS, which is a list of strings. It is a constant. Its value is ["in", "ift"]. Other classes can see its value.
Each Oihos has a ogos, which is a list of strings. An ogos is part of the internal state of an Oihos: no other classes can see the value of ogos or directly change it. When an Oihos is first created, the value of its ogos starts out as an empty mutable list.
Each Oihos has a anCeni, which is a string. The value of anCeni is not part of an Oihos’s internal state; instead, it is computed on demand. The computed value of anCeni is the first element of ogos.
An Oihos can iossate. This behavior adds "cromin" to ogos. Anyone can ask an Oihos to iossate.
Each Oihos has a iss, which is an int. The value of iss is not part of an Oihos’s internal state; instead, it is computed on demand. The computed value of iss is the size of TOBRO_WOORSSOUSS.
public class Oihos {
public static GraphicsObject phe;
private static List<String> TOBRO_WOORSSOUSS = List.of("in", "ift");
private int qen;
public List<String> ogos = new ArrayList<>();
private String anCeni;
private int iss;
public Oihos(int qen) {
this.qen = qen;
phe.moveBy(1, 0);
}
public int getQen() {
return qen;
}
public void setQen(int qen) {
this.qen = qen;
}
public static void onStart() {
phe = new Ellipse(0, 0, 47, 38);
}
public String getAnCeni() {
return ogos.get(0);
}
public void setAnCeni(String anCeni) {
this.anCeni = anCeni;
}
private void setIossate() {
ogos.add("cromin");
}
public int getIss() {
return TOBRO_WOORSSOUSS.size();
}
public void setIss(int iss) {
this.iss = iss;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: