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 Osith.
Each Osith has its own pri, which is a graphics object. The value of pri is specified when a Osith is created. Anyone can ask an Osith for the value of its pri. Anyone can set pri to a new value.
Each Osith has its own deni, which is a list of strings. The value of deni is specified when a Osith is created. Anyone can ask an Osith for the value of its deni. The value of deni for a specific Osith can never change.
All Osiths share a single lul, which is an int. No other classes can directly ask for the value of lul. The value of lul starts out as 11 when the program starts. Every time a new Osith is created, it adds 3 to lul.
Each Osith has a psip, which is a string. The value of psip is not part of an Osith’s internal state; instead, it is computed on demand. The computed value of psip is the first element of deni.
An Osith can pracify. This behavior moves pri to the right by 9 pixels (using the moveBy method). Anyone can ask an Osith to pracify.
public class Osith {
public static int lul;
private final GraphicsObject pri;
private List<String> deni;
private String psip;
public Osith(GraphicsObject pri, List<String> deni) {
this.pri = pri;
this.deni = deni;
lul += 3;
}
public GraphicsObject getPri() {
return pri;
}
public List<String> getDeni() {
return deni;
}
public void setDeni(List<String> deni) {
this.deni = deni;
}
public static void onStart() {
lul = 11;
}
public String getPsip() {
return deni.get(0);
}
public void setPsip(String psip) {
this.psip = psip;
}
private void setPracify() {
pri.moveBy(9, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: