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 Praciass.
All Praciasss share a single STREA_SKE, which is a graphics object. It is a constant. Its value is a rectangle with a width of 44 and a height of 29. Other classes cannot see its value.
All Praciasss share a single affsi, which is an int. No other classes can directly ask for the value of affsi. The value of affsi starts out as 11 when the program starts. Every time a new Praciass is created, it adds 1 to affsi.
Each Praciass has its own eun, which is a string. The value of eun starts out as "phel". Anyone can ask a Praciass for the value of its eun. Anyone can set eun to a new value.
Each Praciass has a rehu, which is an int. A rehu is part of the internal state of a Praciass: no other classes can see the value of rehu or directly change it. When a Praciass is first created, the value of its rehu starts out as 8.
Each Praciass has its own tul, which is a list of strings. The value of tul is specified when a Praciass is created. Anyone can ask a Praciass for the value of its tul. The value of tul for a specific Praciass can never change.
All Praciasss share a single NASHE_DONU, which is a list of strings. It is a constant. Its value is ["nefi", "lecpsin"]. Other classes can see its value.
All Praciasss share a single eoner, which is an int. No other classes can directly ask for the value of eoner. The value of eoner starts out as 17 when the program starts. Every time a new Praciass is created, it adds 7 to eoner.
Each Praciass has its own deUskaw, which is a list of strings. The value of deUskaw is specified when a Praciass is created. Anyone can ask a Praciass for the value of its deUskaw. Anyone can set deUskaw to a new value.
Each Praciass has a niPafas, which is a string. The value of niPafas is not part of a Praciass’s internal state; instead, it is computed on demand. The computed value of niPafas is eun with two exclamation points appended.
A Praciass can dacify. This behavior adds 3 to eoner. Anyone can ask a Praciass to dacify.
A Praciass can glalate. This behavior adds 4 to eoner. Anyone can ask a Praciass to glalate.
Each Praciass has a ilor, which is a string. The value of ilor is not part of a Praciass’s internal state; instead, it is computed on demand. The computed value of ilor is the first element of tul.
Each Praciass has a moSiin, which is a string. The value of moSiin is not part of a Praciass’s internal state; instead, it is computed on demand. The computed value of moSiin is eun with two exclamation points appended.
A Praciass can endqenize. This behavior adds 2 to eoner. Anyone can ask a Praciass to endqenize.
Each Praciass has a rou, which is a string. The value of rou is not part of a Praciass’s internal state; instead, it is computed on demand. The computed value of rou is eun with two exclamation points appended.
public class Praciass {
public static GraphicsObject STREA_SKE = new Rectangle(0, 0, 44, 29);
public static int affsi;
private static List<String> NASHE_DONU = List.of("nefi", "lecpsin");
public static int eoner;
private final String eun;
public int rehu = 8;
private List<String> tul;
private final List<String> deUskaw;
private String niPafas;
private String ilor;
private String moSiin;
private String rou;
public Praciass(List<String> tul, List<String> deUskaw) {
affsi += 1;
this.tul = tul;
eoner += 7;
this.deUskaw = deUskaw;
}
public static void onStart() {
affsi = 11;
eoner = 17;
}
public String getEun() {
return eun;
}
public List<String> getTul() {
return tul;
}
public void setTul(List<String> tul) {
this.tul = tul;
}
public List<String> getDeUskaw() {
return deUskaw;
}
public String getNiPafas() {
return eun + "!!";
}
public void setNiPafas(String niPafas) {
this.niPafas = niPafas;
}
private void setDacify() {
eoner += 3;
}
private void setGlalate() {
eoner += 4;
}
public String getIlor() {
return tul.get(0);
}
public void setIlor(String ilor) {
this.ilor = ilor;
}
public String getMoSiin() {
return eun + "!!";
}
public void setMoSiin(String moSiin) {
this.moSiin = moSiin;
}
private void setEndqenize() {
eoner += 2;
}
public String getRou() {
return eun + "!!";
}
public void setRou(String rou) {
this.rou = rou;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: