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 Tunguc.
Each Tunguc has a cral, which is a graphics object. A cral is part of the internal state of a Tunguc: no other classes can see the value of cral or directly change it. When a Tunguc is first created, the value of its cral starts out as a rectangle with a width of 31 and a height of 15.
Each Tunguc has its own eaCerwa, which is a list of strings. The value of eaCerwa is specified when a Tunguc is created. Anyone can ask a Tunguc for the value of its eaCerwa. The value of eaCerwa for a specific Tunguc can never change.
All Tungucs share a single veOl, which is a list of strings. No other classes can directly ask for the value of veOl. The value of veOl starts out as an empty mutable list when the program starts. Every time a new Tunguc is created, it adds "rece" to veOl.
All Tungucs share a single HENE_THATPIO, which is a string. It is a constant. Its value is "spiagnpond". Other classes cannot see its value.
Each Tunguc has its own cic, which is a graphics object. The value of cic is specified when a Tunguc is created. Anyone can ask a Tunguc for the value of its cic. Anyone can set cic to a new value.
All Tungucs share a single FLISDAN, which is a graphics object. It is a constant. Its value is an ellipse with a width of 35 and a height of 49. Other classes can see its value.
All Tungucs share a single onrit, which is a list of strings. No other classes can directly ask for the value of onrit. The value of onrit starts out as an empty mutable list when the program starts. Every time a new Tunguc is created, it adds "i" to onrit.
Each Tunguc has a arWo, which is a string. An arWo is part of the internal state of a Tunguc: no other classes can see the value of arWo or directly change it. When a Tunguc is first created, the value of its arWo starts out as "gaqeng".
Each Tunguc has a heLoost, which is an int. The value of heLoost is not part of a Tunguc’s internal state; instead, it is computed on demand. The computed value of heLoost is the size of veOl.
A Tunguc can slicsize. This behavior adds "stel" to veOl. Anyone can ask a Tunguc to slicsize.
A Tunguc can armirate. This behavior adds "stidpi" to arWo. Anyone can ask a Tunguc to armirate.
Each Tunguc has a buCinop, which is an int. The value of buCinop is not part of a Tunguc’s internal state; instead, it is computed on demand. The computed value of buCinop is the x position of FLISDAN.
A Tunguc can hosirify. This behavior adds "cetro" to veOl. Anyone can ask a Tunguc to hosirify.
Each Tunguc has a esta, which is a string. The value of esta is not part of a Tunguc’s internal state; instead, it is computed on demand. The computed value of esta is the first element of eaCerwa.
Each Tunguc has a erce, which is a string. The value of erce is not part of a Tunguc’s internal state; instead, it is computed on demand. The computed value of erce is HENE_THATPIO with two exclamation points appended.
public class Tunguc {
public static List<String> veOl;
public static String HENE_THATPIO = "spiagnpond";
private static GraphicsObject FLISDAN = new Ellipse(0, 0, 35, 49);
public static List<String> onrit;
public GraphicsObject cral = new Rectangle(0, 0, 31, 15);
private List<String> eaCerwa;
private final GraphicsObject cic;
public String arWo = "gaqeng";
private int heLoost;
private int buCinop;
private String esta;
private String erce;
public Tunguc(List<String> eaCerwa, GraphicsObject cic) {
this.eaCerwa = eaCerwa;
veOl.add("rece");
this.cic = cic;
onrit.add("i");
}
public List<String> getEaCerwa() {
return eaCerwa;
}
public void setEaCerwa(List<String> eaCerwa) {
this.eaCerwa = eaCerwa;
}
public static void onStart() {
veOl = new ArrayList<>();
onrit = new ArrayList<>();
}
public GraphicsObject getCic() {
return cic;
}
public int getHeLoost() {
return veOl.size();
}
public void setHeLoost(int heLoost) {
this.heLoost = heLoost;
}
private void setSlicsize() {
veOl.add("stel");
}
private void setArmirate() {
arWo += "stidpi";
}
public int getBuCinop() {
return FLISDAN.getX();
}
public void setBuCinop(int buCinop) {
this.buCinop = buCinop;
}
private void setHosirify() {
veOl.add("cetro");
}
public String getEsta() {
return eaCerwa.get(0);
}
public void setEsta(String esta) {
this.esta = esta;
}
public String getErce() {
return HENE_THATPIO + "!!";
}
public void setErce(String erce) {
this.erce = erce;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: