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 Fawuph.
Each Fawuph has its own ner, which is a string. The value of ner starts out as "he". Anyone can ask a Fawuph for the value of its ner. Anyone can set ner to a new value.
All Fawuphs share a single buis, which is a list of strings. No other classes can directly ask for the value of buis. The value of buis starts out as an empty mutable list when the program starts. Every time a new Fawuph is created, it adds "spropax" to buis.
Each Fawuph has a ent, which is a graphics object. An ent is part of the internal state of a Fawuph: no other classes can see the value of ent or directly change it. When a Fawuph is first created, the value of its ent starts out as an ellipse with a width of 10 and a height of 24.
All Fawuphs share a single HESS_FEL, which is a list of strings. It is a constant. Its value is ["is", "hinen"]. Other classes cannot see its value.
Each Fawuph has its own ilEc, which is an int. The value of ilEc is specified when a Fawuph is created. Anyone can ask a Fawuph for the value of its ilEc. The value of ilEc for a specific Fawuph can never change.
Each Fawuph has a parmu, which is a list of strings. A parmu is part of the internal state of a Fawuph: no other classes can see the value of parmu or directly change it. When a Fawuph is first created, the value of its parmu starts out as an empty mutable list.
Each Fawuph has its own keou, which is a graphics object. The value of keou starts out as an ellipse with a width of 42 and a height of 44. Anyone can ask a Fawuph for the value of its keou. Anyone can set keou to a new value.
A Fawuph can ompate. This behavior adds "preltios" to parmu. Anyone can ask a Fawuph to ompate.
Each Fawuph has a chosi, which is an int. The value of chosi is not part of a Fawuph’s internal state; instead, it is computed on demand. The computed value of chosi is ilEc plus 3.
Each Fawuph has a moRi, which is a string. The value of moRi is not part of a Fawuph’s internal state; instead, it is computed on demand. The computed value of moRi is the first element of parmu.
A Fawuph can osanize. This behavior moves ent to the right by 4 pixels (using the moveBy method). Anyone can ask a Fawuph to osanize.
Each Fawuph has a eres, which is an int. The value of eres is not part of a Fawuph’s internal state; instead, it is computed on demand. The computed value of eres is the size of HESS_FEL.
A Fawuph can esdurify. This behavior adds "paph" to ner. Anyone can ask a Fawuph to esdurify.
public class Fawuph {
public static List<String> buis;
public static List<String> HESS_FEL = List.of("is", "hinen");
private final String ner;
public GraphicsObject ent = new Ellipse(0, 0, 10, 24);
private int ilEc;
public List<String> parmu = new ArrayList<>();
private final GraphicsObject keou;
private int chosi;
private String moRi;
private int eres;
public Fawuph(int ilEc) {
buis.add("spropax");
this.ilEc = ilEc;
}
public String getNer() {
return ner;
}
public static void onStart() {
buis = new ArrayList<>();
}
public int getIlEc() {
return ilEc;
}
public void setIlEc(int ilEc) {
this.ilEc = ilEc;
}
public GraphicsObject getKeou() {
return keou;
}
private void setOmpate() {
parmu.add("preltios");
}
public int getChosi() {
return ilEc + 3;
}
public void setChosi(int chosi) {
this.chosi = chosi;
}
public String getMoRi() {
return parmu.get(0);
}
public void setMoRi(String moRi) {
this.moRi = moRi;
}
private void setOsanize() {
ent.moveBy(4, 0);
}
public int getEres() {
return HESS_FEL.size();
}
public void setEres(int eres) {
this.eres = eres;
}
private void setEsdurify() {
ner += "paph";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: