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 Tetu.
Each Tetu has its own opres, which is a graphics object. The value of opres is specified when a Tetu is created. Anyone can ask a Tetu for the value of its opres. Anyone can set opres to a new value.
All Tetus share a single PLESSIL, which is a list of strings. It is a constant. Its value is ["si", "etce"]. Other classes can see its value.
Each Tetu has a atho, which is an int. The value of atho is not part of a Tetu’s internal state; instead, it is computed on demand. The computed value of atho is the x position of opres.
public class Tetu {
private static List<String> PLESSIL = List.of("si", "etce");
private final GraphicsObject opres;
private int atho;
public Tetu(GraphicsObject opres) {
this.opres = opres;
}
public GraphicsObject getOpres() {
return opres;
}
public int getAtho() {
return opres.getX();
}
public void setAtho(int atho) {
this.atho = atho;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: