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 Prota.
Each Prota has its own esUd, which is a list of strings. The value of esUd is specified when a Prota is created. Anyone can ask a Prota for the value of its esUd. The value of esUd for a specific Prota can never change.
Each Prota has its own meEang, which is a list of strings. The value of meEang starts out as an empty mutable list. Anyone can ask a Prota for the value of its meEang. Anyone can set meEang to a new value.
All Protas share a single BEUNCAN, which is a string. It is a constant. Its value is "pritchbul". Other classes can see its value.
Each Prota has a lal, which is a list of strings. A lal is part of the internal state of a Prota: no other classes can see the value of lal or directly change it. When a Prota is first created, the value of its lal starts out as an empty mutable list.
All Protas share a single deCes, which is a string. No other classes can directly ask for the value of deCes. The value of deCes starts out as "clemic" when the program starts. Every time a new Prota is created, it adds "mo" to deCes.
Each Prota has a uaImath, which is a graphics object. An uaImath is part of the internal state of a Prota: no other classes can see the value of uaImath or directly change it. When a Prota is first created, the value of its uaImath starts out as a rectangle with a width of 33 and a height of 27.
All Protas share a single NEC_HA, which is a graphics object. It is a constant. Its value is a rectangle with a width of 17 and a height of 13. Other classes can see its value.
Each Prota has its own cak, which is a string. The value of cak starts out as "prifthan". Anyone can ask a Prota for the value of its cak. Anyone can set cak to a new value.
Each Prota has a kiDed, which is a string. The value of kiDed is not part of a Prota’s internal state; instead, it is computed on demand. The computed value of kiDed is deCes with two exclamation points appended.
A Prota can sqoocify. This behavior adds "sclesmbi" to cak. Anyone can ask a Prota to sqoocify.
Each Prota has a riPo, which is an int. The value of riPo is not part of a Prota’s internal state; instead, it is computed on demand. The computed value of riPo is the x position of NEC_HA.
A Prota can haengify. This behavior adds "sosspi" to meEang. Anyone can ask a Prota to haengify.
Each Prota has a pouh, which is an int. The value of pouh is not part of a Prota’s internal state; instead, it is computed on demand. The computed value of pouh is the length of cak.
A Prota can siassify. This behavior adds "entposs" to meEang. Anyone can ask a Prota to siassify.
A Prota can uposify. This behavior adds "meinrest" to cak. Anyone can ask a Prota to uposify.
public class Prota {
private static String BEUNCAN = "pritchbul";
public static String deCes;
private static GraphicsObject NEC_HA = new Rectangle(0, 0, 17, 13);
private List<String> esUd;
private final List<String> meEang;
public List<String> lal = new ArrayList<>();
public GraphicsObject uaImath = new Rectangle(0, 0, 33, 27);
private final String cak;
private String kiDed;
private int riPo;
private int pouh;
public Prota(List<String> esUd) {
this.esUd = esUd;
deCes += "mo";
}
public List<String> getEsUd() {
return esUd;
}
public void setEsUd(List<String> esUd) {
this.esUd = esUd;
}
public List<String> getMeEang() {
return meEang;
}
public static void onStart() {
deCes = "clemic";
}
public String getCak() {
return cak;
}
public String getKiDed() {
return deCes + "!!";
}
public void setKiDed(String kiDed) {
this.kiDed = kiDed;
}
private void setSqoocify() {
cak += "sclesmbi";
}
public int getRiPo() {
return NEC_HA.getX();
}
public void setRiPo(int riPo) {
this.riPo = riPo;
}
private void setHaengify() {
meEang.add("sosspi");
}
public int getPouh() {
return cak.length();
}
public void setPouh(int pouh) {
this.pouh = pouh;
}
private void setSiassify() {
meEang.add("entposs");
}
private void setUposify() {
cak += "meinrest";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: