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 Pocis.
All Pociss share a single ERTROON, which is a list of strings. It is a constant. Its value is ["ek", "flun"]. Other classes cannot see its value.
Each Pocis has its own kic, which is a string. The value of kic is specified when a Pocis is created. Anyone can ask a Pocis for the value of its kic. The value of kic for a specific Pocis can never change.
Each Pocis has a epra, which is an int. An epra is part of the internal state of a Pocis: no other classes can see the value of epra or directly change it. When a Pocis is first created, the value of its epra starts out as 5.
Each Pocis has its own enCieam, which is a string. The value of enCieam starts out as "haooc". Anyone can ask a Pocis for the value of its enCieam. Anyone can set enCieam to a new value.
All Pociss share a single laIm, which is an int. No other classes can directly ask for the value of laIm. The value of laIm starts out as 3 when the program starts. Every time a new Pocis is created, it adds 5 to laIm.
Each Pocis has its own saSe, which is a graphics object. The value of saSe is specified when a Pocis is created. Anyone can ask a Pocis for the value of its saSe. The value of saSe for a specific Pocis can never change.
Each Pocis has a suc, which is a list of strings. A suc is part of the internal state of a Pocis: no other classes can see the value of suc or directly change it. When a Pocis is first created, the value of its suc starts out as an empty mutable list.
A Pocis can asfatify. This behavior adds 2 to epra. Anyone can ask a Pocis to asfatify.
Each Pocis has a esGeald, which is an int. The value of esGeald is not part of a Pocis’s internal state; instead, it is computed on demand. The computed value of esGeald is the x position of saSe.
Each Pocis has a chuc, which is an int. The value of chuc is not part of a Pocis’s internal state; instead, it is computed on demand. The computed value of chuc is laIm plus 9.
A Pocis can cegize. This behavior adds "nergre" to enCieam. Anyone can ask a Pocis to cegize.
Each Pocis has a orol, which is an int. The value of orol is not part of a Pocis’s internal state; instead, it is computed on demand. The computed value of orol is epra squared.
A Pocis can olsinate. This behavior adds 9 to epra. Anyone can ask a Pocis to olsinate.
public class Pocis {
public static List<String> ERTROON = List.of("ek", "flun");
public static int laIm;
private String kic;
public int epra = 5;
private final String enCieam;
private GraphicsObject saSe;
public List<String> suc = new ArrayList<>();
private int esGeald;
private int chuc;
private int orol;
public Pocis(String kic, GraphicsObject saSe) {
this.kic = kic;
laIm += 5;
this.saSe = saSe;
}
public String getKic() {
return kic;
}
public void setKic(String kic) {
this.kic = kic;
}
public String getEnCieam() {
return enCieam;
}
public static void onStart() {
laIm = 3;
}
public GraphicsObject getSaSe() {
return saSe;
}
public void setSaSe(GraphicsObject saSe) {
this.saSe = saSe;
}
private void setAsfatify() {
epra += 2;
}
public int getEsGeald() {
return saSe.getX();
}
public void setEsGeald(int esGeald) {
this.esGeald = esGeald;
}
public int getChuc() {
return laIm + 9;
}
public void setChuc(int chuc) {
this.chuc = chuc;
}
private void setCegize() {
enCieam += "nergre";
}
public int getOrol() {
return epra * epra;
}
public void setOrol(int orol) {
this.orol = orol;
}
private void setOlsinate() {
epra += 9;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: