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 Tavin.
All Tavins share a single PSAL_CHLUJU, which is a list of strings. It is a constant. Its value is ["afo", "geu", "shentspiol"]. Other classes can see its value.
Each Tavin has a alNesil, which is a graphics object. An alNesil is part of the internal state of a Tavin: no other classes can see the value of alNesil or directly change it. When a Tavin is first created, the value of its alNesil starts out as a rectangle with a width of 35 and a height of 39.
Each Tavin has its own ichir, which is an int. The value of ichir starts out as 3. Anyone can ask a Tavin for the value of its ichir. Anyone can set ichir to a new value.
Each Tavin has its own seDasni, which is an int. The value of seDasni is specified when a Tavin is created. Anyone can ask a Tavin for the value of its seDasni. The value of seDasni for a specific Tavin can never change.
All Tavins share a single fio, which is a list of strings. No other classes can directly ask for the value of fio. The value of fio starts out as an empty mutable list when the program starts. Every time a new Tavin is created, it adds "bem" to fio.
Each Tavin has a cibe, which is an int. The value of cibe is not part of a Tavin’s internal state; instead, it is computed on demand. The computed value of cibe is seDasni plus 6.
A Tavin can niudify. This behavior adds "seckur" to fio. Anyone can ask a Tavin to niudify.
Each Tavin has a siHanbe, which is an int. The value of siHanbe is not part of a Tavin’s internal state; instead, it is computed on demand. The computed value of siHanbe is seDasni plus 7.
A Tavin can pabrilize. This behavior adds "asael" to fio. Anyone can ask a Tavin to pabrilize.
public class Tavin {
private static List<String> PSAL_CHLUJU = List.of("afo", "geu", "shentspiol");
public static List<String> fio;
public GraphicsObject alNesil = new Rectangle(0, 0, 35, 39);
private final int ichir;
private int seDasni;
private int cibe;
private int siHanbe;
public Tavin(int seDasni) {
this.seDasni = seDasni;
fio.add("bem");
}
public int getIchir() {
return ichir;
}
public int getSeDasni() {
return seDasni;
}
public void setSeDasni(int seDasni) {
this.seDasni = seDasni;
}
public static void onStart() {
fio = new ArrayList<>();
}
public int getCibe() {
return seDasni + 6;
}
public void setCibe(int cibe) {
this.cibe = cibe;
}
private void setNiudify() {
fio.add("seckur");
}
public int getSiHanbe() {
return seDasni + 7;
}
public void setSiHanbe(int siHanbe) {
this.siHanbe = siHanbe;
}
private void setPabrilize() {
fio.add("asael");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: