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 an Entsosh.
Each Entsosh has a siIen, which is a list of strings. A siIen is part of the internal state of an Entsosh: no other classes can see the value of siIen or directly change it. When an Entsosh is first created, the value of its siIen starts out as an empty mutable list.
Each Entsosh has its own fel, which is an int. The value of fel is specified when a Entsosh is created. Anyone can ask an Entsosh for the value of its fel. The value of fel for a specific Entsosh can never change.
All Entsoshs share a single VIEDXISS, which is a string. It is a constant. Its value is "bral". Other classes can see its value.
Each Entsosh has its own bie, which is a string. The value of bie is specified when a Entsosh is created. Anyone can ask an Entsosh for the value of its bie. Anyone can set bie to a new value.
All Entsoshs share a single piol, which is a graphics object. No other classes can directly ask for the value of piol. The value of piol starts out as an ellipse with a width of 21 and a height of 46 when the program starts. Every time a new Entsosh is created, it moves piol to the right by 6 pixels (using the moveBy method).
All Entsoshs share a single hiCer, which is a graphics object. No other classes can directly ask for the value of hiCer. The value of hiCer starts out as an ellipse with a width of 11 and a height of 25 when the program starts. Every time a new Entsosh is created, it moves hiCer to the right by 2 pixels (using the moveBy method).
Each Entsosh has a umCac, which is a string. The value of umCac is not part of an Entsosh’s internal state; instead, it is computed on demand. The computed value of umCac is bie with two exclamation points appended.
An Entsosh can seomize. This behavior moves hiCer to the right by 5 pixels (using the moveBy method). Anyone can ask an Entsosh to seomize.
An Entsosh can shuenate. This behavior adds "scasan" to bie. Anyone can ask an Entsosh to shuenate.
Each Entsosh has a ceTror, which is an int. The value of ceTror is not part of an Entsosh’s internal state; instead, it is computed on demand. The computed value of ceTror is the x position of hiCer.
An Entsosh can pridify. This behavior adds "cohil" to siIen. Anyone can ask an Entsosh to pridify.
public class Entsosh {
private static String VI_ED_XISS = "bral";
public static GraphicsObject piol;
public static GraphicsObject hiCer;
public List<String> siIen = new ArrayList<>();
private int fel;
private final String bie;
private String umCac;
private int ceTror;
public Entsosh(int fel, String bie) {
this.fel = fel;
this.bie = bie;
piol.moveBy(6, 0);
hiCer.moveBy(2, 0);
}
public int getFel() {
return fel;
}
public void setFel(int fel) {
this.fel = fel;
}
public String getBie() {
return bie;
}
public static void onStart() {
piol = new Ellipse(0, 0, 21, 46);
hiCer = new Ellipse(0, 0, 11, 25);
}
public String getUmCac() {
return bie + "!!";
}
public void setUmCac(String umCac) {
this.umCac = umCac;
}
private void setSeomize() {
hiCer.moveBy(5, 0);
}
private void setShuenate() {
bie += "scasan";
}
public int getCeTror() {
return hiCer.getX();
}
public void setCeTror(int ceTror) {
this.ceTror = ceTror;
}
private void setPridify() {
siIen.add("cohil");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: