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 Lisess.
Each Lisess has a cuJiad, which is a graphics object. A cuJiad is part of the internal state of a Lisess: no other classes can see the value of cuJiad or directly change it. When a Lisess is first created, the value of its cuJiad starts out as an ellipse with a width of 15 and a height of 28.
All Lisesss share a single GROSAR, which is a list of strings. It is a constant. Its value is ["is", "pec", "pelrom"]. Other classes can see its value.
Each Lisess has its own urel, which is a graphics object. The value of urel is specified when a Lisess is created. Anyone can ask a Lisess for the value of its urel. Anyone can set urel to a new value.
Each Lisess has its own imPe, which is an int. The value of imPe is specified when a Lisess is created. Anyone can ask a Lisess for the value of its imPe. The value of imPe for a specific Lisess can never change.
All Lisesss share a single ooSceri, which is an int. No other classes can directly ask for the value of ooSceri. The value of ooSceri starts out as 9 when the program starts. Every time a new Lisess is created, it adds 7 to ooSceri.
A Lisess can uosify. This behavior moves urel to the right by 1 pixels (using the moveBy method). Anyone can ask a Lisess to uosify.
Each Lisess has a cato, which is an int. The value of cato is not part of a Lisess’s internal state; instead, it is computed on demand. The computed value of cato is ooSceri plus 5.
A Lisess can tusalize. This behavior adds 5 to ooSceri. Anyone can ask a Lisess to tusalize.
Each Lisess has a dros, which is an int. The value of dros is not part of a Lisess’s internal state; instead, it is computed on demand. The computed value of dros is ooSceri plus 4.
public class Lisess {
private static List<String> GROSAR = List.of("is", "pec", "pelrom");
public static int ooSceri;
public GraphicsObject cuJiad = new Ellipse(0, 0, 15, 28);
private final GraphicsObject urel;
private int imPe;
private int cato;
private int dros;
public Lisess(GraphicsObject urel, int imPe) {
this.urel = urel;
this.imPe = imPe;
ooSceri += 7;
}
public GraphicsObject getUrel() {
return urel;
}
public int getImPe() {
return imPe;
}
public void setImPe(int imPe) {
this.imPe = imPe;
}
public static void onStart() {
ooSceri = 9;
}
private void setUosify() {
urel.moveBy(1, 0);
}
public int getCato() {
return ooSceri + 5;
}
public void setCato(int cato) {
this.cato = cato;
}
private void setTusalize() {
ooSceri += 5;
}
public int getDros() {
return ooSceri + 4;
}
public void setDros(int dros) {
this.dros = dros;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: