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 Ituor.
Each Ituor has a adWi, which is an int. An adWi is part of the internal state of an Ituor: no other classes can see the value of adWi or directly change it. When an Ituor is first created, the value of its adWi starts out as 2.
All Ituors share a single CED_STUERTHION, which is a graphics object. It is a constant. Its value is a rectangle with a width of 13 and a height of 29. Other classes cannot see its value.
Each Ituor has its own owCii, which is a string. The value of owCii starts out as "esh". Anyone can ask an Ituor for the value of its owCii. Anyone can set owCii to a new value.
Each Ituor has its own paDe, which is an int. The value of paDe is specified when a Ituor is created. Anyone can ask an Ituor for the value of its paDe. The value of paDe for a specific Ituor can never change.
All Ituors share a single bri, which is a string. No other classes can directly ask for the value of bri. The value of bri starts out as "mo" when the program starts. Every time a new Ituor is created, it adds "spo" to bri.
All Ituors share a single PIMAR_IOLET, which is a string. It is a constant. Its value is "ciare". Other classes cannot see its value.
Each Ituor has its own iaken, which is a list of strings. The value of iaken starts out as an empty mutable list. Anyone can ask an Ituor for the value of its iaken. Anyone can set iaken to a new value.
Each Ituor has a woc, which is a string. The value of woc is not part of an Ituor’s internal state; instead, it is computed on demand. The computed value of woc is owCii with two exclamation points appended.
An Ituor can beelify. This behavior adds "phirmi" to iaken. Anyone can ask an Ituor to beelify.
Each Ituor has a cas, which is an int. The value of cas is not part of an Ituor’s internal state; instead, it is computed on demand. The computed value of cas is adWi plus 5.
An Ituor can scolify. This behavior adds "tand" to bri. Anyone can ask an Ituor to scolify.
An Ituor can vualate. This behavior adds "wosstri" to bri. Anyone can ask an Ituor to vualate.
Each Ituor has a poo, which is an int. The value of poo is not part of an Ituor’s internal state; instead, it is computed on demand. The computed value of poo is the length of bri.
public class Ituor {
public static GraphicsObject CED_STUERTHION = new Rectangle(0, 0, 13, 29);
public static String bri;
public static String PIMAR_IOLET = "ciare";
public int adWi = 2;
private final String owCii;
private int paDe;
private final List<String> iaken;
private String woc;
private int cas;
private int poo;
public Ituor(int paDe) {
this.paDe = paDe;
bri += "spo";
}
public String getOwCii() {
return owCii;
}
public int getPaDe() {
return paDe;
}
public void setPaDe(int paDe) {
this.paDe = paDe;
}
public static void onStart() {
bri = "mo";
}
public List<String> getIaken() {
return iaken;
}
public String getWoc() {
return owCii + "!!";
}
public void setWoc(String woc) {
this.woc = woc;
}
private void setBeelify() {
iaken.add("phirmi");
}
public int getCas() {
return adWi + 5;
}
public void setCas(int cas) {
this.cas = cas;
}
private void setScolify() {
bri += "tand";
}
private void setVualate() {
bri += "wosstri";
}
public int getPoo() {
return bri.length();
}
public void setPoo(int poo) {
this.poo = poo;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: