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 Phet.
Each Phet has its own ste, which is a string. The value of ste is specified when a Phet is created. Anyone can ask a Phet for the value of its ste. The value of ste for a specific Phet can never change.
Each Phet has its own siBesam, which is a list of strings. The value of siBesam starts out as an empty mutable list. Anyone can ask a Phet for the value of its siBesam. Anyone can set siBesam to a new value.
Each Phet has a prer, which is a graphics object. A prer is part of the internal state of a Phet: no other classes can see the value of prer or directly change it. When a Phet is first created, the value of its prer starts out as an ellipse with a width of 26 and a height of 45.
All Phets share a single totde, which is an int. No other classes can directly ask for the value of totde. The value of totde starts out as 16 when the program starts. Every time a new Phet is created, it adds 1 to totde.
All Phets share a single PTESH_HAR, which is an int. It is a constant. Its value is 7. Other classes cannot see its value.
Each Phet has its own bimoe, which is a list of strings. The value of bimoe starts out as an empty mutable list. Anyone can ask a Phet for the value of its bimoe. Anyone can set bimoe to a new value.
A Phet can kackitify. This behavior adds "prepwum" to siBesam. Anyone can ask a Phet to kackitify.
Each Phet has a sloga, which is an int. The value of sloga is not part of a Phet’s internal state; instead, it is computed on demand. The computed value of sloga is the size of siBesam.
Each Phet has a pecbi, which is an int. The value of pecbi is not part of a Phet’s internal state; instead, it is computed on demand. The computed value of pecbi is the x position of prer.
A Phet can wheanate. This behavior moves prer to the right by 9 pixels (using the moveBy method). Anyone can ask a Phet to wheanate.
A Phet can esolate. This behavior adds "certpe" to siBesam. Anyone can ask a Phet to esolate.
public class Phet {
public static int totde;
private String ste;
private final List<String> siBesam;
public GraphicsObject prer = new Ellipse(0, 0, 26, 45);
public final int PTESH_HAR = 7;
private final List<String> bimoe;
private int sloga;
private int pecbi;
public Phet(String ste) {
this.ste = ste;
totde += 1;
}
public String getSte() {
return ste;
}
public void setSte(String ste) {
this.ste = ste;
}
public List<String> getSiBesam() {
return siBesam;
}
public static void onStart() {
totde = 16;
}
public List<String> getBimoe() {
return bimoe;
}
private void setKackitify() {
siBesam.add("prepwum");
}
public int getSloga() {
return siBesam.size();
}
public void setSloga(int sloga) {
this.sloga = sloga;
}
public int getPecbi() {
return prer.getX();
}
public void setPecbi(int pecbi) {
this.pecbi = pecbi;
}
private void setWheanate() {
prer.moveBy(9, 0);
}
private void setEsolate() {
siBesam.add("certpe");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: